Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Dark was here.


local nearplayer
local Players = game:GetService("Players")
function MoveShelly()
	
	nearplayer = false

	for _,Player in next, Players:GetPlayers() do 
		if Player.Character and Player.Character.PrimaryPart then
			local dis = (Player.Character.PrimaryPart.CFrame.Position - shelly.PrimaryPart.CFrame.Position).Magnitude
			if dis >= 500 then
				nearplayer = true
				break
			end
		end
	end

	if nearplayer then
		task.wait(math.random(8, 8 + 8/2))
		return
	end
	
	bp.Parent = shelly.PrimaryPart
	local goal
	repeat 
	local ray = Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether), shelly.PrimaryPart.Position.Y+100, origin.p.z+math.random(-tether,tether)),Vector3.new(0,-130,0))
	local part,pos,norm,mat = workspace:FindPartOnRay(ray, shelly)
	if part == workspace.Terrain and mat ~= Enum.Material.Water then
		goal = pos+Vector3.new(0,.35,0)
	end
	task.wait()
	until goal
	--Set new goal for banto to MoveTo :)
	local pos = shelly.PrimaryPart.Position
	local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
	bg.CFrame = cf
	bp.Position = (cf*CFrame.new(0,0,-100)).p
	
	local start = tick()
	repeat task.wait(.5)
	local ray = Ray.new(shelly.PrimaryPart.Position, Vector3.new(0,-140,0))
	
	until (shelly.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >15 or not shellyGood
	if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
	bp.Parent = nil
	task.wait(math.random(3,8))
end


local soundBank = game.ServerStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
	if shellyGood then
		bp.Parent,bg.Parent= nil,nil
		shelly.PrimaryPart.Transparency =1
		shelly.PrimaryPart.CanCollide = false
		shelly.Shell.Transparency = 1
		shelly.HitShell.Transparency = 0
		shelly.HitShell.CanCollide = true
		shellyGood = false
		ostrich = os.clock()
		shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
		local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
		hitSound.PlayOnRemove = true
		hitSound.Parent = shelly.PrimaryPart
		task.wait()
		hitSound:Destroy()
		
		repeat task.wait() until os.clock()-ostrich > 10
		shelly.PrimaryPart.Transparency = 0
		shelly.PrimaryPart.CanCollide = true
		shelly.Shell.Transparency = 0
		shelly.HitShell.Transparency = 1
		shelly.HitShell.CanCollide = false
		bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
		shellyGood = true
	end
end)

while true do
	if shellyGood then
		MoveShelly()
	else
		task.wait(1)
	end 
end
--[=[
	Based on the given [UserInputType], a cooresponding enum representing the
	current device is returned.

	```lua
	getCurrentDevice(Enum.UserInputType.KeyCode) -- "Computer"
	getCurrentDevice(Enum.UserInputType.Touch) -- "Mobile"
	getCurrentDevice(Enum.UserInputType.Gamepad1) -- "Gamepad"
	```

	@within Modules
]=]


local function getCurrentDevice(inputType: Enum.UserInputType)
	for group, patterns in pairs(constants.DeviceInputTypePatterns) do
		for _, pattern in ipairs(patterns) do
			if inputType.Name:match(pattern) then
				return enums.Device[group]
			end
		end
	end

	return enums.Device.Unknown
end

return getCurrentDevice
--//ENGINE//--


Horsepower = 1500  --{This is how much power your engine block makes ALONE, this does not represent to total horsepower output [IF you have a turbo/SC]}
EngineDisplacement = 2200 --{Engine size in CC's}
EngineType =  "Petrol" --{Petrol, Diesel, Electric]
EngineLocation = "Front" --{Front, Mid, Rear}
ForcedInduction = "Supercharger" --{Natural, Single, Twin, Supercharger} 
InductionPartSize = 1 --{0-5, 1 being small, 5 being large (Decimals accepted, e.g 2.64 turbo size, this is the size of the turbo}
ElectronicallyLimited = false --{Electronically Limit the top speed of your vehicle}
LimitSpeedValue = 236.121 --{Limits top speed of the vehicle [In MPH]}
--- Skill


local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://4835590095"

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Z and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = false
		Tool.Active.Value = "SunaTornado"
		wait(0.1)
		Track1 = Player.Character.Humanoid:LoadAnimation(Animation)
		Track1:Play()
		wait(0.15)
		script.Fire:FireServer(plr)
	local hum =  Player.Character.Humanoid
	for i = 1,30 do
		wait()
		hum.CameraOffset = Vector3.new(
			math.random(-1,1),
			math.random(-1,1),
			math.random(-1,1)
		)
	end
	hum.CameraOffset = Vector3.new(0,0,0)
	    wait(0.15)
		Tool.Active.Value = "None"
		wait(2)
		Debounce = true
	end
end)
--[[Susupension]]


	Tune.SusEnabled		= false		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
	
	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)
	
	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FPreCompress	= .4		-- Pre-compression adds resting length force
	Tune.FExtensionLim	= .4		-- Max Extension Travel (in studs)
	Tune.FCompressLim	= .4		-- Max Compression Travel (in studs)
	Tune.FSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.FWsBoneLen		= 5			-- Wishbone Length
	Tune.FWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.FAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward
	
	--Rear Suspension
	Tune.RSusDamping	= 500		-- Spring Dampening
	Tune.RSusStiffness	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

	Tune.RSusLength		= 2			-- Suspension length (in studs)
	Tune.RPreCompress	= .4		-- Pre-compression adds resting length force
	Tune.RExtensionLim	= .4		-- Max Extension Travel (in studs)
	Tune.RCompressLim	= .4		-- Max Compression Travel (in studs)
	Tune.RSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.RWsBoneLen		= 5			-- Wishbone Length
	Tune.RWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Aesthetics	
	Tune.SusVisible		= true			-- Spring Visible
	Tune.WsBVisible		= false			-- Wishbone Visible
	Tune.SusRadius		= .2			-- Suspension Coil Radius
	Tune.SusThickness	= .1			-- Suspension Coil Thickness
	Tune.SusColor		= "Really black"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness
--Both


local Loudness = .75 --volume of the boost supplier (not exact volume so you kinda have to experiment with it also)

script:WaitForChild("Whistle")
script:WaitForChild("Whine")
script:WaitForChild("BOV")

for i,v in pairs(car.DriveSeat:GetChildren()) do
	for _,a in pairs(script:GetChildren()) do
		if v.Name==a.Name then v:Stop() wait() v:Destroy() end
	end
end

car.DriveSeat.ChildRemoved:connect(function(child)
	if child.Name=="SeatWeld" then
		for i,v in pairs(car.DriveSeat:GetChildren()) do
			for _,a in pairs(script:GetChildren()) do
				if v.Name==a.Name then v:Stop() wait() v:Destroy() end
			end
		end
	end
end)

if not _Tune.Engine then return end
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","Whine",car.DriveSeat,script.Whine.SoundId,0,script.Whine.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
handler:FireServer("playSound","Whine")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("Whine")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end

while wait() do
	local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
	--(script.Parent.Values.RPM.Value/_Tune.Redline)
	local WP,WV,BP,BV,HP,HV = 0
	
	BOVact = math.floor(psi*20)
	if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Double" then
		WP = (psi)
		WV = (psi/4)*Loudness
		
		BP = (1-(-psi/20))*BOV_Pitch
		BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
	
		if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
		if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
	elseif _Tune.Aspiration == "Super" then
		psi = psi/2
		HP = (script.Parent.Values.RPM.Value/_Tune.Redline)*Whine_Pitch
		HV = (psi/4)*Loudness
	end
	
	handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
	handler:FireServer("updateSound","Whine",script.Whine.SoundId,HP,HV)
	handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
	
	if (tick()-ticc) >= 0.1 then
		BOVact2 = math.floor(psi*20)
		ticc = tick()
	end
end
-- if version < SNAPSHOT_VERSION then
-- 	return Error(
-- 		chalk.red(
-- 			chalk.red.bold('Outdated snapshot') .. ": The version of the snapshot " ..
-- 			"file associated with this test is outdated. The snapshot file " ..
-- 			"version ensures that all developers on a project are using " ..
-- 			"the same version of Jest. " ..
-- 			"Please update all snapshots during this upgrade of Jest.\n\n"
-- 		) ..
-- 		"Expected: v" .. SNAPSHOT_VERSION .. "\n" ..
-- 		"Received: v" .. version .. "\n\n" ..
-- 		SNAPSHOT_VERSION_WARNING
-- 	)
-- end
--- Add sounds when interacting with a gui element




return function(element, interactType, interactSoundId, interactSoundVolume, enableRandomPitch)
	--- Variables
	interactType = string.lower(interactType)
	interactSoundVolume = interactSoundVolume or 0.15
	enableRandomPitch = enableRandomPitch or false
	--
	local events = {}
	
	--- Events
	if interactType == "mousedown" then
		--- Mouse down
		events[#events + 1] = element.MouseButton1Down:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume * 2)
		end)
		
	elseif interactType == "mouseup" then
		--- Mouse up
		events[#events + 1] = element.MouseButton1Up:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume * 2)
		end)
		
	elseif interactType == "mouseenter" then
		--- Mouse hover over
		events[#events + 1] = element.MouseEnter:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
		end)

	elseif interactType == "mouseleave" then
		--- Mouse hover leave
		events[#events + 1] = element.MouseLeave:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
		end)
	
	elseif interactType == "mouseclick" then
		--- Mouse click
		events[#events + 1] = element.MouseButton1Click:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
		end)
	end
	
	--- Return function to cancel this behavior
	return function()
		for _, event in ipairs(events) do
			event:disconnect()
		end
		events = nil
	end
end
-- @Context Server
-- Given a weapon definition, position, and direction. A projectile will be simulated on all clients. 
-- @param WeaponDefinition weaponDefinition
-- @param Vector3 position
-- @param Vector3 direction
-- @param Player _owner


function ProjectileReplication.ReplicateProjectile(weaponDefinition, position, direction, _owner)
	if RunService:IsServer() then
		--print("Sending visual to all clients",weaponDefinition, position, direction, _owner)
		-- If the server makes the request to replicate a projectile then then this is sent to everyone besides the sender
		RE_CreateProjectile:FireAllClients(weaponDefinition:GetIDName(), position, direction, _owner)
	end
end
--		print(AnimName .. " * " .. Index .. " [" .. OrigRoll .. "]")


		local Anim = AnimTable[AnimName][Index].Anim

		-- load it to the humanoid; get AnimationTrack
		ToolAnimTrack = Humanoid:LoadAnimation(Anim)
		 
		-- play the animation
		ToolAnimTrack:Play(TransitionTime)
		ToolAnimName = AnimName

		CurrentToolAnimKeyframeHandler = ToolAnimTrack.KeyframeReached:connect(ToolKeyframeReachedFunc)
	end
end

function StopToolAnimations()
	local OldAnim = ToolAnimName

	if CurrentToolAnimKeyframeHandler then
		CurrentToolAnimKeyframeHandler:disconnect()
	end

	ToolAnimName = ""
	if ToolAnimTrack then
		ToolAnimTrack:Stop()
		ToolAnimTrack:Destroy()
		ToolAnimTrack = nil
	end

	return OldAnim
end
--// This method is to be used with the new filter API. This method takes the
--// TextFilterResult objects and converts them into the appropriate string
--// messages for each player.


function methods:InternalSendFilteredMessageWithFilterResult(inMessageObj, channelName)
	local messageObj = ShallowCopy(inMessageObj)

	local oldFilterResult = messageObj.FilterResult
	local player = self:GetPlayer()

	local msg = ""
	pcall(function()
		if (messageObj.IsFilterResult) then
			if (player) then
				msg = oldFilterResult:GetChatForUserAsync(player.UserId)
			else
				msg = oldFilterResult:GetNonChatStringForBroadcastAsync()
			end
		else
			msg = oldFilterResult
		end
	end)

	--// Messages of 0 length are the result of two users not being allowed
	--// to chat, or GetChatForUserAsync() failing. In both of these situations,
	--// messages with length of 0 should not be sent.

	if UserFlagRemoveMessageOnTextFilterFailures then
		messageObj.Message = msg
		messageObj.FilterResult = nil
		self:InternalSendFilteredMessage(messageObj, channelName)
	else
		if (#msg > 0) then
			messageObj.Message = msg
			messageObj.FilterResult = nil
			self:InternalSendFilteredMessage(messageObj, channelName)
		end
	end
end

function methods:InternalSendSystemMessage(messageObj, channelName)
	local success, err = pcall(function()
		self:LazyFire("eReceivedSystemMessage", messageObj, channelName)
		if self.PlayerObj then
			self.EventFolder.OnNewSystemMessage:FireClient(self.PlayerObj, messageObj, channelName)
		end
	end)
	if not success and err then
		print("Error sending internal system message: " ..err)
	end
end

function methods:UpdateChannelNameColor(channelName, channelNameColor)
	self:LazyFire("eChannelNameColorUpdated", channelName, channelNameColor)
	if self.PlayerObj then
		self.EventFolder.ChannelNameColorUpdated:FireClient(self.PlayerObj, channelName, channelNameColor)
	end
end
-- please do not distribute this plugin and pass it as yours



WheelModel = script.Parent:WaitForChild("Wheels")
rainEffect = script:WaitForChild("RainEffect")
wheels = {}
touchingparts = {}

for i, v in pairs(WheelModel:GetChildren()) do
	if v:IsA("BasePart") then
		table.insert(wheels, v)
		rainEffect:Clone().Parent = v
		table.insert(touchingparts, nil)
	end
end
for i, v in pairs(wheels) do
	v.Touched:connect(function(part)
		touchingparts[i] = part
	end)
end
RunService = game:GetService("RunService")

RunService.Heartbeat:connect(function()
	for i, v in pairs(wheels) do
		local speed = v.Velocity.magnitude
		if speed > 20 then
			if touchingparts[i].Material == Enum.Material.Glass or touchingparts[i].Material == Enum.Material.Ice then
				v.RainEffect.Rate = 5/100 * speed * 10
			else
				v.RainEffect.Rate = 0
			end
		else
			v.RainEffect.Rate = 0
		end
	end
end)
-- Signal types


export type Connection = {
	Disconnect: (self: Connection) -> (),
	Destroy: (self: Connection) -> (),
	Connected: boolean,
}

export type Signal<T...> = {
	Fire: (self: Signal<T...>, T...) -> (),
	FireDeferred: (self: Signal<T...>, T...) -> (),
	Connect: (self: Signal<T...>, fn: (T...) -> ()) -> Connection,
	Once: (self: Signal<T...>, fn: (T...) -> ()) -> Connection,
	DisconnectAll: (self: Signal<T...>) -> (),
	GetConnections: (self: Signal<T...>) -> { Connection },
	Destroy: (self: Signal<T...>) -> (),
	Wait: (self: Signal<T...>) -> T...,
}
--------END STAGE--------
--------CREW--------



game.Workspace.crewview1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crew2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crew3.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
--------------------------------------------------


script.Parent.Values.RPM.Changed:connect(function()
	intach.Rotation = -65 + script.Parent.Values.RPM.Value * 250 / 8000
end)

script.Parent.Values.Velocity.Changed:connect(function(property)
	inspd.Rotation = -30 + (440 / 160) * (math.abs(script.Parent.Values.Velocity.Value.Magnitude*((10/12) * (50/88))))
end)

script.Parent.Values.Gear.Changed:connect(function()
	local gearText = script.Parent.Values.Gear.Value
	if gearText == 0 then 
		gearText = "N"
		car.Body.Dash.DashSc.G.Gear.Text = "N"
		car.DriveSeat.Filter:FireServer('reverse',false)
	elseif gearText == -1 then
		gearText = "R"
		car.Body.Dash.DashSc.G.Gear.Text = "R"
		car.DriveSeat.Filter:FireServer('reverse',true)
	end
	car.Body.Dash.DashSc.G.Gear.Text = gearText
end)

script.Parent.Values.PBrake.Changed:connect(function()
	dash.PBrake.Visible = script.Parent.Values.PBrake.Value
end)

local car = script.Parent.Car.Value
local Values = script.Parent.Values
local _Tune = require(car["A-Chassis Tune"])


game["Run Service"].Stepped:connect(function()
	local rev = (Values.RPM.Value/_Tune.Redline)
	local MPHScale = (10/12) * (60/88)
	local KPHScale = (10/12) * 1.09728
	local Speed = Values.Velocity.Value.Magnitude
	car.Body.Gauges.Screen.FPGauges.Gauge.RPMFrame.Fill.Size = UDim2.new(rev,0,1,0)
	car.Body.Gauges.Screen.FPGauges.Gauge.Gear.Gear.Text = Values.Gear.Value
	car.Body.Gauges.Screen.FPGauges.Gauge.Speed.MPH.Text = " ".. math.floor(Speed*MPHScale)
	car.Body.Gauges.Screen.FPGauges.Gauge.Speed.KPH.Text = "  ".. math.floor(Speed*KPHScale)
end)
--- Setting Fire ---


local fire = script.Fire
fire.Parent = pellet
fire.Enabled = true
damage = 10


local DebrisService = game:GetService('Debris')

function TagHumanoid(humanoid, vPlayer)
	-- Add more tags here to customize what tags are available.
	local creatorTag = Instance.new("ObjectValue")
	creatorTag.Value = vPlayer
	creatorTag.Name = "creator"
	creatorTag.Parent = humanoid
	DebrisService:AddItem(creatorTag, 1.5)
end

function FireScript(human)
	if human.Parent.Torso:FindFirstChild("FIRE")~= nil then
	else
		local FireBurn = script.FIRE:Clone()
		FireBurn.Parent = human.Parent.Torso
		FireBurn.FireDamage.Disabled = false
	end
end

function onTouched(hit)
	if hit and hit.Parent then
		if HitPeople[hit.Parent.Name] then
--use this to determine if you want this human to be harmed or not, returns boolean


function checkTeams(otherHuman)
	return not (sameTeam(otherHuman) and not FriendlyFire==true)
end

function boom()
	wait(1.5)
	Used = true
	Object.Anchored = true
	Object.CanCollide = false
	Object.Sparks.Enabled = false
	Object.Orientation = Vector3.new(0,0,0)
	Object.Transparency = 1
	Object.Fuse:Stop()
	Object.Explode:Play()
	Object.Dist:Play()
	Object.Explosion:Emit(30)
	Object.Smoke1:Emit(30)
	Object.Smoke2:Emit(30)
	Object.Debris:Emit(10)
	Object.exlight:Emit(2)
	Object.dust:Emit(50)
	Beps.Transparency = 1
	Explode()
	
end

Object.Touched:Connect(function(part)
	if Used == true or part.Name == "Handle" then return end
	if part:IsDescendantOf(Tag.Value.Character) then return end
	if part.Parent then
		if part.Parent:FindFirstChild("Humanoid") then
			local human = part.Parent.Humanoid
			if checkTeams(human) then
				tagHuman(human)
				human:TakeDamage(Damage)
			end
		end
		Used = true
		Object.Impact:Play()
		Object.Velocity = Vector3.new(Object.Velocity.x/10,Object.Velocity.y/10,Object.Velocity.z/10)
		Object.RotVelocity = Vector3.new(Object.RotVelocity.x/10,Object.RotVelocity.y/10,Object.RotVelocity.z/10)
		game:GetService("Debris"):AddItem(Object, 10)
	end
end)

boom()
--Made by Luckymaxer



Debris = game:GetService("Debris")

Creator = script:FindFirstChild("Creator")
Tool = script:FindFirstChild("Tool")
Model = script:WaitForChild("Model")

function DestroyModel()
	if Model and Model.Parent then
		Debris:AddItem(Model, 2)
	end
	Debris:AddItem(script, 2)
end

if not Creator or not Creator.Value or not Creator.Value:IsA("Player") or not Creator.Value.Parent or not Tool or not Tool.Value or not Tool.Value.Parent or not Model or not Model.Value then
	DestroyModel()
	return
end

Creator = Creator.Value
Tool = Tool.Value
Model = Model.Value

Character = Creator.Character
if not Character then
	DestroyModel()
	return
end

Creator.Changed:connect(function(Property)
	if Property == "Parent" and not Creator.Parent then
		DestroyModel()
	end
end)

Character.Changed:connect(function(Property)
	if Property == "Parent" and not Character.Parent then
		DestroyModel()
	end
end)

Tool.Changed:connect(function(Property)
	if Property == "Parent" then
		DestroyModel()
	end
end)

Model.Changed:connect(function(Property)
	if Property == "Parent" and not Model.Parent then
		DestroyModel()
	end
end)
-- See if I have a tool


local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
   Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
	if part and part.Parent and part.Parent:IsA("Tool") then
		tool = part.Parent
		break
	end
end

local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
	if configTable:FindFirstChild(configName) then
		configs[configName] = configTable:FindFirstChild(configName).Value
	else
		configs[configName] = defaultValue
	end
end

loadConfig("SpawnCooldown", 5)

if tool then
	tool.Parent = game.ServerStorage
	
	while true do
		-- put tool on pad
		local toolCopy = tool:Clone()
		local handle = toolCopy:FindFirstChild("Handle")
		toolCopy.Parent = game.Workspace
		local toolOnPad = true
		local parentConnection
		parentConnection = toolCopy.AncestryChanged:connect(function()
			if handle then handle.Anchored = false end
			toolOnPad = false
			parentConnection:disconnect()
		end)
		if handle then
			print("removed spin")
			handle.Anchored = true
		end
		-- wait for tool to be removed
		while toolOnPad do 
			if handle then
				print("removed spinning")
			end
			wait() 
		end
		
		-- wait for cooldown
		wait(configs["SpawnCooldown"])		
	end
	
end
--!strict


local Array = script.Parent
local isArray = require(Array.isArray)
type Array<T> = { [number]: T }

return function(array: Array<any>, ...): number
	if _G.__DEV__ then
		if not isArray(array) then
			error(string.format("Array.unshift called on non-array %s", typeof(array)))
		end
	end

	local numberOfItems = select("#", ...)
	if numberOfItems > 0 then
		for i = numberOfItems, 1, -1 do
			local toInsert = select(i, ...)
			table.insert(array, 1, toInsert)
		end
	end

	return #array
end
--fetching effectlib


local common_modules = game.ReplicatedStorage.CommonModules
EFFECT_LIB = require(common_modules.EffectLib)

local function GenColor(t, rate)
	local get_t = ((t - math.floor(t / rate) * rate) / rate) * math.pi * 2
	  
	local red = math.sin(get_t + 0) * 0.5 + 0.5
	local green = math.sin(get_t + math.pi / 2) * 0.5 + 0.5
	local blue = math.sin(get_t + math.pi) * 0.5 + 0.5
	
	return Color3.new(red, green, blue)
end