Pinkstack/roblox-luau-corpus-text huggingface dataset:
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{21,20,58},t},
[49]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{21,20,19},t},
[59]={{21,20,57,56,30,41,59},t},
[63]={{21,20,63},t},
[34]={{21,20,57,56,30,41,39,35,34},t},
[21]={{21},t},
[48]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{21,20,57,56,30,41,39,35,34,32,31},t},
[56]={{21,20,57,56},t},
[29]={{21,20,57,56,30,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45},t},
[57]={{21,20,57},t},
[36]={{21,20,57,56,30,41,39,35,37,36},t},
[25]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{21,20,57,56,30,41,59,61,71},t},
[20]={{21,20},t},
[60]={{21,20,57,56,30,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{21,20,57,56,30,41,59,61,71,72,76,73,75},t},
[22]={{21,22},t},
[74]={{21,20,57,56,30,41,59,61,71,72,76,73,74},t},
[62]={{21,20,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{21,20,57,56,30,41,39,35,37},t},
[2]={n,f},
[35]={{21,20,57,56,30,41,39,35},t},
[53]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{21,20,57,56,30,41,59,61,71,72,76,73},t},
[72]={{21,20,57,56,30,41,59,61,71,72},t},
[33]={{21,20,57,56,30,41,39,35,37,36,33},t},
[69]={{21,20,57,56,30,41,60,69},t},
[65]={{21,20,19,66,64,65},t},
[26]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27,26},t},
[68]={{21,20,19,66,64,67,68},t},
[76]={{21,20,57,56,30,41,59,61,71,72,76},t},
[50]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{21,20,19,66},t},
[10]={n,f},
[24]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{21,20,62,23},t},
[44]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44},t},
[39]={{21,20,57,56,30,41,39},t},
[32]={{21,20,57,56,30,41,39,35,34,32},t},
[3]={n,f},
[30]={{21,20,57,56,30},t},
[51]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{21,20,19,66,64,67},t},
[61]={{21,20,57,56,30,41,59,61},t},
[55]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{21,20,57,56,30,41,39,40,38,42},t},
[40]={{21,20,57,56,30,41,39,40},t},
[52]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{21,20,57,56,30,41},t},
[17]={n,f},
[38]={{21,20,57,56,30,41,39,40,38},t},
[28]={{21,20,57,56,30,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{21,20,19,66,64},t},
}
return r
-- this script was created in order to stop player from being slippery because the A-Chassis car they were driving was regenerated without them hopping off first



local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharactedAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local SeatSpeed = 16
local SaveSpeed
local seated

Humanoid.Seated:Connect(function()
	if seated then
		Humanoid.WalkSpeed = SaveSpeed
		seated = false
		
		-- stop player from being slippery
		for i, part in ipairs(Character:GetChildren()) do
			if part:IsA("Part") then
				part.CustomPhysicalProperties = PhysicalProperties.new(Enum.Material.Plastic)
			end
		end
		
	else
		SaveSpeed = Humanoid.WalkSpeed
		Humanoid.WalkSpeed = SeatSpeed
		seated = true
	end
end)
--vehicle.Nose.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
--vehicle.Bumper_Front.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
--vehicle.Bumper_Back.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
--vehicle.Tailgate.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
--vehicle.ExhaustPipe.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)



frontForceField.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, -1, 0)) end)
backForceField.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 1, 0)) end)

vehicle.Wheel_BackLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
vehicle.Wheel_FrontLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
vehicle.Wheel_BackRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
vehicle.Wheel_FrontRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)

local vehicleDamaged = false
function checkIfVehicleIsDamaged()
	if (not frontForceField.Parent or not backForceField.Parent) and not vehicleDamaged and allowDamage then
		vehicleDamaged = true
		script.IsDamaged.Value = true
		vehicle.VehicleScript.Disabled = true
		vehicleSmoke.Enabled = true
		vehicle.VehicleSeat.MaxSpeed = 0
		vehicle.ExhaustPipe.Smoke.Enabled = false
		-- Break Joints
		vehicle.Wheel_BackLeft:BreakJoints()
		vehicle.Wheel_FrontLeft:BreakJoints()
		vehicle.Wheel_BackRight:BreakJoints()
		vehicle.Wheel_FrontRight:BreakJoints()
		hood:BreakJoints()
	end
end

vehicle.ChildRemoved:connect(checkIfVehicleIsDamaged)
-- LOCAL


local ZoneController = {}
local Maid = require(script.Parent.Parent.Maid)
local RotatedRegion3 = require(script.Parent.Parent.RotatedRegion3)
local Enum_ = require(script.Parent.Enum)
local enum = Enum_.enums
local players = game:GetService("Players")
local activeZones = {}
local activeZonesTotalVolume = 0
local charactersTotalVolume = 0
local activeTriggers = {}
local registeredZones = {}
local activeParts = {}
local activePartToZone = {}
local allParts = {}
local allPartToZone = {}
local bodyParts = {}
local activeConnections = 0
local runService = game:GetService("RunService")
local heartbeat = runService.Heartbeat
local heartbeatConnections = {}
local localPlayer = runService:IsClient() and players.LocalPlayer
local playerExitDetections = {}
local WHOLE_BODY_DETECTION_LIMIT = 729000 -- This is roughly the volume where Region3 checks begin to exceed 0.5% in Script Performance
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data


return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	return plrData.Classes.Super.Viper.HiddenViper.Value ~= true
end
------------------



local Tool = script.Parent
local Humanoid
local Playing = false

local UIS = game:GetService("UserInputService")
local Animation = script:WaitForChild("Animation")
local AnimTrack


UIS.InputBegan:Connect(function(Input, GameProcessedEvent)
	if Input.KeyCode == Key and Humanoid and AnimTrack then
		if not GameProcessedEvent and not Playing then
			Playing = true
			AnimTrack:Play()
			wait(AnimationLength)
			Playing = false
		end
	end
end)

Tool.Equipped:Connect(function()
	Humanoid = Tool.Parent:FindFirstChildOfClass("Humanoid")
	AnimTrack = Humanoid:LoadAnimation(Animation)
end)
-- Generated by https://roblox-ts.github.io v0.0.34
-- Compiled May 9, 2019, 6:07 PM Coordinated Universal Time



local _exports = {};
Direction = Direction or {};
do
	Direction.N = 1;
	Direction[1] = "N";
	Direction.S = 2;
	Direction[2] = "S";
	Direction.E = 4;
	Direction[4] = "E";
	Direction.W = 8;
	Direction[8] = "W";
end
_exports.Direction = Direction;
return _exports;
------------------------------------------


local pit = gui.PitchControl
pit.TextLabel.Text = ("Pitch: "..(radio.Pitch.Value*50).."%")
radio.Pitch.Changed:connect(function()
	pit.TextLabel.Text = ("Pitch: "..(radio.Pitch.Value*50).."%")
end)
pit.Up.MouseButton1Click:connect(function()
	radio.Pitch.Value = math.min(radio.Pitch.Value+.5,300)
end)
pit.Down.MouseButton1Click:connect(function()
	radio.Pitch.Value = math.max(radio.Pitch.Value-.5,0)
end)
-- Modules


local ModuleScripts = ReplicatedStorage.ModuleScripts
local GameSettings = require(ModuleScripts.GameSettings)
local PlayerManagement = ServerScriptService.PlayerManagement
local PlayerManagementModules = PlayerManagement.ModuleScripts
local ParticleController = require(PlayerManagementModules.ParticleController)
local Data = ServerScriptService.Data
local DataStore = require(Data.Modules.DataStore)
local UpgradeManager = require(Data.Modules.UpgradeManager)
--[[Weight and CG]]


	Tune.Weight			= 0		-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		6		,
	 --[[Height]]		3.5		,
	 --[[Length]]		14		}
	Tune.WeightDist		= 70		-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
	Tune.CGHeight		= .8		-- Center of gravity height (studs relative to median of all wheels)
	Tune.WBVisible		= false		-- Makes the weight brick visible
	
	--Unsprung Weight
	Tune.FWheelDensity	= .1		-- Front Wheel Density
	Tune.RWheelDensity	= .1		-- Rear Wheel Density
	Tune.FWLgcyDensity	= 1			-- Front Wheel Density [PGS OFF]
	Tune.RWLgcyDensity	= 1			-- Rear Wheel Density [PGS OFF]
	
	Tune.AxleSize		= 2			-- Size of structural members (larger = more stable/carry more weight)
	Tune.AxleDensity	= .1		-- Density of structural members
-- Levels up the player if they have enough experience to do so.


function PlayerLeveling:TryLevelUp(Player: Player, Level, XP)
	if PlayerLeveling:CanLevelUp(Player, Level, XP) then
		local Plus = math.floor(XP.Value / (Level.Value * XPPerLevel))
		local Remainder = math.clamp(math.floor(XP.Value - (Level.Value * XPPerLevel) * Plus), 0, math.huge)
		Level.Value = math.clamp(Level.Value + Plus, 1, math.huge)
		XP.Value = Remainder
	end
end

return PlayerLeveling
--// F key, Horn


mouse.KeyUp:connect(function(key)
	if key=="f" then 
		veh.Lightbar.middle.Airhorn:Stop()
		veh.Lightbar.middle.Wail.Volume = 2
		veh.Lightbar.middle.Yelp.Volume = 2
		veh.Lightbar.middle.Priority.Volume = 2
	end
end)








mouse.KeyDown:connect(function(key)
	if key=="j" then 
		veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
	end
	end)
--[[
	Calls any :finally handlers. We need this to be a separate method and
	queue because we must call all of the finally callbacks upon a success,
	failure, *and* cancellation.
]]


function Promise.prototype:_finalize()
	for _, callback in ipairs(self._queuedFinally) do
		-- Purposefully not passing values to callbacks here, as it could be the
		-- resolved values, or rejected errors. If the developer needs the values,
		-- they should use :andThen or :catch(explicitly.
		coroutine.wrap(callback)(self._status)
	end

	self._queuedFinally = nil
	self._queuedReject = nil
	self._queuedResolve = nil

	-- Clear references to other Promises to allow gc
	if not Promise.TEST then
		self._parent = nil
		self._consumers = nil
	end
end
--DevVince was here. :o


local shelly = script.Parent
local origin = shelly.PrimaryPart.CFrame
local tether = 15
local bg = shelly.PrimaryPart:WaitForChild'BodyGyro'
local bp = shelly.PrimaryPart:WaitForChild'BodyPosition'
bp.Position = origin.p
bg.CFrame = shelly.PrimaryPart.CFrame
local shellyGood = true
local ostrich = os.clock()
---[[ Message Settings ]]


module.MaximumMessageLength = 256
module.DisallowedWhiteSpace = {"\n", "\r", "\t", "\v", "\f"}
module.ClickOnPlayerNameToWhisper = true
module.ClickOnChannelNameToSetMainChannel = true
module.BubbleChatMessageTypes = {ChatConstants.MessageTypeDefault, ChatConstants.MessageTypeWhisper}
--Gear Ratios


Tune.FinalDrive		= 3.42			-- Gearing determines top speed and wheel torque
Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
	--[[Reverse]]	3.70		,	-- Copy and paste a ratio to add a gear
	--[[Neutral]]	0			,	-- Ratios can also be deleted
	--[[ 1 ]]		3.53		,	-- Reverse, Neutral, and 1st gear are required
	--[[ 2 ]]		2.04		,
	--[[ 3 ]]		1.38		,
	--[[ 4 ]]		1.03		,
	--[[ 5 ]]		0.81		,
	--[[ 6 ]]		0.64		,
}
Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
---------------------------


function Gameplay.setup()
	if not Gameplay.connections.respawnCharacterAddedConn then
		Gameplay.connections.respawnCharacterAddedConn = Players.LocalPlayer.CharacterAdded:Connect(function()
			Gameplay.setup()
		end)
	end

	WeaponsSystem.setGetTeamCallback(function(player)
		return PlayerMatchInfo.GetField(player, "teamNumber")
	end)

	BuildingSystem.setEnabled(false)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

	local skydiver = Skydiver.new()
	skydiver:setEnabled(false)
	skydiver:setOnDisabled(Gameplay.onSkydiverDisabled)

	if not PlayerMatchInfo.GetField(Players.LocalPlayer, "didJump") then
		-- Initialize minimap and focus on delivery vehicle for player's team (or the one delivery vehicle if no teams)
		local deliveryVehicle = Workspace:WaitForChild("DeliveryVehicle" .. tostring(PlayerMatchInfo.GetField(Players.LocalPlayer, "teamNumber")))
		Util.setClientFocus(deliveryVehicle)

		-- Get orientation of delivery vehicle to give to minimap for dividing line in team mode
		local dividingAngle = nil
		if Conf.num_teams == 2 then
			dividingAngle = 90 - deliveryVehicle:WaitForChild("Root").Orientation.Y
		end
		MinimapGui.start(dividingAngle)

		-- Focus the camera on the bus
		WeaponsSystem.camera:setEnabled(false)
		WeaponsSystem.gui:setEnabled(false)
		Workspace.CurrentCamera.CameraSubject = deliveryVehicle:WaitForChild("Root")
		Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
		Players.LocalPlayer.CameraMinZoomDistance = MIN_DELIVERY_CAMERA_DISTANCE

		-- Wait for it to be safe to skydive
		local readyValue = deliveryVehicle:WaitForChild("Ready")
		if not readyValue.Value then
			readyValue.Changed:Wait()
		end

		-- Display the prompt and allow the player to jump out of the bus
		skydiver:setWaitingForJump(true)

		-- Yield until the player jumps out of the bus
		skydiver:waitForJumped()

		-- Mark the player as having jumped out of the bus
		PlayerMatchInfo.UpdateField(Players.LocalPlayer, "didJump", true)
	end

	-- Start skydiving
	skydiver:setEnabled(true)

	-- Focus minimap on player instead of bus
	Util.setClientFocus(Players.LocalPlayer.Character)

	-- Reenable the weapon system camera now that the player is skydiving
	WeaponsSystem.camera:setEnabled(true)
	Players.LocalPlayer.CameraMinZoomDistance = StarterPlayer.CameraMinZoomDistance

	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, Conf.gameplay.gameplay_chat_enabled)
end

function Gameplay.onSkydiverDisabled()
	BuildingSystem.setEnabled(true)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end

function Gameplay.shutdown()
end
-- Visualizes a ray. This will not run if FastCast.VisualizeCasts is false.


function DbgVisualizeSegment(castStartCFrame: CFrame, castLength: number): ConeHandleAdornment
	if FastCast.VisualizeCasts ~= true then return end
	local adornment = Instance.new("ConeHandleAdornment")
	adornment.Adornee = workspace.Terrain
	adornment.CFrame = castStartCFrame
	adornment.Height = castLength
	adornment.Color3 = Color3.new()
	adornment.Radius = 0.25
	adornment.Transparency = 0.5
	adornment.Parent = GetFastCastVisualizationContainer()
	return adornment
end
--------------------[ KNIFING FUNCTION ]----------------------------------------------



function KnifeAnim()
	local Connection = nil
	local Blade = Instance.new("Part")
	Blade.BrickColor = BrickColor.new("Really black")
	Blade.Name = "Blade"
	Blade.CanCollide = false
	Blade.FormFactor = Enum.FormFactor.Custom
	Blade.Size = VEC3(0.5, 2.5, 1)
	local Mesh = Instance.new("SpecialMesh")
	Mesh.MeshId = 121944778
	Mesh.MeshType = Enum.MeshType.FileMesh
	Mesh.Scale = VEC3(0.7, 0.7, 0.7)
	Mesh.TextureId = 121944805
	Mesh.Parent = Blade
	Blade.Parent = Gun_Ignore
	local BladeWeld = Instance.new("Weld")
	BladeWeld.Part0 = Blade
	BladeWeld.Part1 = FakeLArm
	BladeWeld.C0 = CFANG(RAD(-90), 0, RAD(180))
	BladeWeld.C1 = CF(0, -1, 0.75)
	BladeWeld.Parent = Blade
	Connection = Blade.Touched:connect(function(Obj)
		if Obj then
			local HitHumanoid = FindFirstClass(Obj.Parent, "Humanoid")
			if HitHumanoid and IsEnemy(HitHumanoid) then
				local CreatorTag = Instance.new("ObjectValue")
				CreatorTag.Name = "creator"
				CreatorTag.Value = Player
				CreatorTag.Parent = HitHumanoid
				HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
				MarkHit()
			end
		end
	end)
	TweenJoint(LWeld2, CF(), CFANG(0, RAD(90), 0), Linear, 0.05)
	TweenJoint(LWeld, ArmC0[1], CF(-0.1, 0.2, -0.1) * CFANG(0, 0, RAD(-20)), Linear, 0.05)
	TweenJoint(RWeld, ArmC0[2], CFANG(RAD(-30), 0, 0), Linear, 0.1)
	TweenJoint(Grip, Grip.C0, CF(), Linear, 0.1)
	spawn(function()
		local Force = HRP.CFrame.lookVector * 8e4
		local BF = Instance.new("BodyForce")
		BF.force = Force
		BF.Parent = HRP
		delay(0.03, function()
			BF.force = -Force / 2
			wait(0.03)
			BF:Destroy()
		end)
	end)
	wait(0.05)
	RotCamera(RAD(6), 0, true, 0.1)
	delay(0.1, function()
		RotCamera(RAD(-2), 0, true, 0.05)
	end)
	TweenJoint(LWeld, ArmC0[1], CF(0.8, 1.7, 0.2) * CFANG(0, 0, RAD(-80)), Linear, 0.06)
	wait(0.2)
	Connection:disconnect()
	wait(0.2)
	TweenJoint(LWeld2, CF(), CF(), Linear, 0.15)
	TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Linear, 0.15)
	TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Linear, 0.15)
	Blade:Destroy()
end
-- May return NaN or inf or -inf
-- This is a way of finding the angle between the two vectors:


local function findAngleBetweenXZVectors(vec2, vec1)
	return math_atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z)
end

local function CreateAttachCamera()
	local module = RootCameraCreator()
	
	local lastUpdate = tick()
	function module:Update()
		local now = tick()
		
		local camera = 	workspace.CurrentCamera
		
		if lastUpdate == nil or now - lastUpdate > 1 then
			module:ResetCameraLook()
			self.LastCameraTransform = nil
		end	
		
		local subjectPosition = self:GetSubjectPosition()		
		if subjectPosition and camera then
			local zoom = self:GetCameraZoom()
			if zoom <= 0 then
				zoom = 0.1
			end


			local humanoid = self:GetHumanoid()
			if lastUpdate and humanoid and humanoid.Torso then
				
				-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
				local delta = math_min(0.1, now - lastUpdate)
				local gamepadRotation = self:UpdateGamepad()
				self.RotateInput = self.RotateInput + (gamepadRotation * delta)		
				
				local forwardVector = humanoid.Torso.CFrame.lookVector

				local y = findAngleBetweenXZVectors(forwardVector, self:GetCameraLook())
				if IsFinite(y) then
					-- Preserve vertical rotation from user input
					self.RotateInput = Vector2_new(y, self.RotateInput.Y)
				end
			end

			local newLookVector = self:RotateCamera(self:GetCameraLook(), self.RotateInput)
			self.RotateInput = ZERO_VECTOR2

			camera.Focus = CFrame_new(subjectPosition)
			local newCFrame = CFrame_new(subjectPosition - (zoom * newLookVector), subjectPosition)
			camera.CFrame = newCFrame
			self.LastCameraTransform = newCFrame
		end
		lastUpdate = now
	end
	
	return module
end

return CreateAttachCamera
--returns the wielding player of this tool


function getPlayer()
	local char = Tool.Parent
	return game:GetService("Players"):GetPlayerFromCharacter(Character)
end

function Toss(direction)
	local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
	local spawnPos = Character.Head.Position
	
	spawnPos  = spawnPos + (direction * 5)
	Tool.Handle.Part.Transparency = 1
	
	local Object = Tool.Handle:Clone()
	Object.Parent = workspace
	Object.Part.Transparency = 0
	
	Object.Fuse:Play()
	
	Object.Swing.Pitch = Random.new():NextInteger(90, 110)/100
	Object.Swing:Play()
	
	Object.CanCollide = true
	Object.CFrame = Tool.Handle.CFrame
	Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
	Object.Trail.Enabled = true
	
	local rand = 11.25
	Object.RotVelocity = Vector3.new(Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand))
	Object:SetNetworkOwner(getPlayer())
	
	local ScriptClone = DamageScript:Clone()
	ScriptClone.Parent = Object
	ScriptClone.Disabled = false
	
	local tag = Instance.new("ObjectValue")
	tag.Value = getPlayer()
	tag.Name = "creator"
	tag.Parent = Object
end

PowerRemote.OnServerEvent:Connect(function(player, Power)
	local holder = getPlayer()
	if holder ~= player then return end
	
	AttackVelocity = Power
end)

TossRemote.OnServerEvent:Connect(function(player, mousePosition)
	local holder = getPlayer()
	if holder ~= player then return end
	
	if Cooldown.Value == true then return end
	Cooldown.Value = true
	
	local holder = getPlayer()
	
	if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
		TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation")
	end
	local targetPos = mousePosition.p
	local lookAt = (targetPos - Character.Head.Position).unit
	
	Toss(lookAt)
	
	Tool:Destroy()
end)

Tool.Equipped:Connect(function()
	Character = Tool.Parent
	Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)

Tool.Unequipped:Connect(function()
	Character = nil
	Humanoid = nil
end)
-- When extend()ing a component, you don't get an extend method.
-- This is to promote composition over inheritance.
-- PureComponent is an exception to this rule.


PureComponent.extend = Component.extend

function PureComponent:shouldUpdate(newProps, newState)
	-- In a vast majority of cases, if state updated, something has updated.
	-- We don't bother checking in this case.
	if newState ~= self.state then
		return true
	end

	if newProps == self.props then
		return false
	end

	for key, value in pairs(newProps) do
		if self.props[key] ~= value then
			return true
		end
	end

	for key, value in pairs(self.props) do
		if newProps[key] ~= value then
			return true
		end
	end

	return false
end

return PureComponent
--[=[
	Loads data. This returns the originally loaded data.
	@param keyName string
	@param defaultValue any?
	@return any?
]=]


function DataStore:Load(keyName, defaultValue)
	return self:_promiseLoad()
		:Then(function(data)
			return self:_afterLoadGetAndApplyStagedData(keyName, data, defaultValue)
		end)
end

function DataStore:_saveData(writer)
	local maid = Maid.new()

	local promise = Promise.new()
	promise:Resolve(maid:GivePromise(DataStorePromises.updateAsync(self._robloxDataStore, self._key, function(data)
		if promise:IsRejected() then
			-- Cancel if we have another request
			return nil
		end

		data = writer:WriteMerge(data or {})
		assert(data ~= DataStoreDeleteToken, "Cannot delete from UpdateAsync")

		if DEBUG_WRITING then
			print("[DataStore] - Writing", game:GetService("HttpService"):JSONEncode(data))
		end

		return data
	end, function(err)
		-- Might be caused by Maid rejecting state
		warn("[DataStore] - Failed to UpdateAsync data", err)
		return Promise.rejected(err)
	end)))

	self._maid._saveMaid = maid

	if self.Saving.Destroy then
		self.Saving:Fire(promise)
	end

	return promise
end

function DataStore:_promiseLoad()
	if self._loadPromise then
		return self._loadPromise
	end

	self._loadPromise = self._maid:GivePromise(DataStorePromises.getAsync(self._robloxDataStore, self._key)
		:Then(function(data)
			if data == nil then
				return {}
			elseif type(data) == "table" then
				return data
			else
				return Promise.rejected("Failed to load data. Wrong type '" .. type(data) .. "'")
			end
		end, function(err)
			-- Log:
			warn("[DataStore] - Failed to GetAsync data", err)
			return Promise.rejected(err)
		end))

	return self._loadPromise
end

return DataStore
--- Cleans up the Tasks assigned to the Maid
-- This Disconnects RBXScriptConnections, Destroys Instances, and calls Functions/callable Tables


function Maid:DoCleaning()
	local Tasks = self._Tasks
	for Name, Task in next, Tasks do
		local Type = typeof(Task)
		local IsTable = Type == "table"
		if Type == "RBXScriptConnection" or IsTable and Task.Disconnect then
			Task:Disconnect()
		elseif Type == "Instance" or IsTable and Task.Destroy then
			Task:Destroy()
		else
			Task()
		end
		Tasks[Name] = nil
	end
end
Maid.Disconnect = Maid.DoCleaning
Maid.Destroy = Maid.DoCleaning