Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[
	signal = Signal.new()
	signal:Fire(...)
	signal:Wait()
	signal:Destroy()
	signal:DisconnectAll()
	
	connection = signal:Connect(functionHandler)
	connection.Connected
	connection:Disconnect()
	connection:IsConnected()
--]]



local Connection = {}
Connection.__index = Connection

function Connection.new(signal, connection)
	local self = setmetatable({
		_signal = signal;
		_conn = connection;
		Connected = true;
	}, Connection)
	return self
end

function Connection:Disconnect()
	if (self._conn) then
		self._conn:Disconnect()
		self._conn = nil
	end
	if (not self._signal) then return end
	self.Connected = false
	local connections = self._signal._connections
	local connectionIndex = table.find(connections, self)
	if (connectionIndex) then
		local n = #connections
		connections[connectionIndex] = connections[n]
		connections[n] = nil
	end
	self._signal = nil
end

function Connection:IsConnected()
	if (self._conn) then
		return self._conn.Connected
	end
	return false
end

Connection.Destroy = Connection.Disconnect
--------------------------------------------------- Mobile Button



local function handleContext(name, state, input)
	if state == Enum.UserInputState.Begin then
		if CameraEffect == true then
			TweenService:Create(Camera, TweenInfo.new(0.5), {FieldOfView = 90}):Play()
		end
		Humanoid.WalkSpeed = SprintSpeed
	else
		if CameraEffect == true then
			TweenService:Create(Camera, TweenInfo.new(0.5), {FieldOfView = 70}):Play()
		end
		Humanoid.WalkSpeed = NormalWalkSpeed
	end
end

cas:BindAction("Sprint", handleContext, true, Leftc, RightC)
cas:SetPosition("Sprint", UDim2.new(.2, 0, .5, 0))
cas:SetTitle("Sprint", "Sprint")
cas:GetButton("Sprint").Size = UDim2.new(.3, 0, .3, 0)
-- Private Methods



function init(self)
	local button = self.Button
	local listFrame = self.ListFrame
	
	--local function contentSizeUpdate()
	--	local absSize = button.AbsoluteSize
	--	local ratio = absSize.y / absSize.x
		
	--	button.Arrow.Size = UDim2.new(ratio, 0, 1, 0)
	--	button.Option.Size = UDim2.new(1 - ratio, -12, 1, 0)
	--end
	
	--contentSizeUpdate()
	--self._Maid:Mark(button:GetPropertyChangedSignal("AbsoluteSize"):Connect(contentSizeUpdate))
	
	for i, optionButton in next, listFrame.ScrollFrame:GetChildren() do
		if not optionButton:IsA("GuiButton") then
			continue
		end
		
		self._Options[i] = optionButton
		optionButton.Activated:Connect(function()
			self:Set(optionButton)
		end)
	end

	self._Maid:Mark(button.Activated:Connect(function()
		self:Show(not listFrame.Visible)
	end))
	
	self._Maid:Mark(UIS.InputBegan:Connect(function(input)
		if (VALID_PRESS[input.UserInputType]) then
			local p = input.Position
			local p2 = Vector2.new(p.x, p.y)
			
			if (listFrame.Visible and not (isInFrame(listFrame, p2) or isInFrame(button, p2))) then
				self:Show(false)
			end
		end
	end))
end

function isInFrame(frame, pos)
	local fPos = frame.AbsolutePosition
	local fSize = frame.AbsoluteSize
	local d = pos - fPos
	return (d.x >= 0 and d.x <= fSize.x and d.y >= 0 and d.y <= fSize.y)
end
--[[Output Scaling Factor]]



	local hpScaling = _Tune.WeightScaling*100
	local FBrakeForce = _Tune.FBrakeForce
	local RBrakeForce = _Tune.RBrakeForce
	local PBrakeForce = _Tune.PBrakeForce
	if not workspace:PGSIsEnabled() then
		hpScaling = _Tune.LegacyScaling*100
		FBrakeForce = _Tune.FLgcyBForce
		RBrakeForce = _Tune.RLgcyBForce
		PBrakeForce = _Tune.LgcyPBForce
	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 = tick()

function MoveShelly()
	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
	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
	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 = tick()
		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
		wait()
		hitSound:Destroy()
		
		repeat task.wait() until tick()-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
--script.Parent.BBB.Velocity = script.Parent.BBB.CFrame.lookVector *script.Parent.Speed.Value


script.Parent.BBBB.Velocity = script.Parent.BBBB.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.C.Velocity = script.Parent.C.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.CC.Velocity = script.Parent.CC.CFrame.lookVector *script.Parent.Speed.Value
--local Network = require(Replicated.Network)


local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer
if not LocalPlayer then
	Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
	LocalPlayer = Players.LocalPlayer
end

local Camera = Workspace.CurrentCamera
Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
	local newCamera = Workspace.CurrentCamera
	if newCamera then
		Camera = newCamera
	end
end)
--!strict
--SecondsToClock
--Yuuwa0519
--2021-08-25



return function(seconds: number): ...number
    local rawHours: number = seconds / 3600
    local fullHours: number = math.floor(rawHours)
    local partialHours: number = rawHours - fullHours

    local rawMinutes: number = partialHours * 60
    local fullMinutes: number = math.floor(rawMinutes)
    local partialMinutes: number = rawMinutes - fullMinutes
    
    local rawSeconds: number = partialMinutes * 60
    local fullSeconds: number = math.round(rawSeconds)

    if fullSeconds == 60 then
        fullMinutes += 1
        fullSeconds = 0
    end

    if fullMinutes == 60 then
        fullHours += 1
        fullMinutes = 0
    end

    return fullHours, fullMinutes, fullSeconds
end
--Points layout instructions--
-- Place the S2 on the track with the A parts, and the S1 on the track with the B parts. 
-- Each route with a set of points is automatically decided.



local s1 = script.Parent.S1
local s2 = script.Parent.S2
local s3 = script.Parent.S3
local aparts = script.Parent.AParts:GetChildren()
local bparts = script.Parent.BParts:GetChildren()
--- Connect a new handler to the event. Returns a connection object that can be disconnected.
-- @tparam function handler Function handler called with arguments passed when `:Fire(...)` is called
-- @treturn Connection Connection object that can be disconnected


function Signal:Connect(handler)
	if not (type(handler) == "function") then
		error(("connect(%s)"):format(typeof(handler)), 2)
	end

	return self._bindableEvent.Event:Connect(function()
		if self._argData ~= nil and self._argCount ~= nil then
			handler(unpack(self._argData, 1, self._argCount))
		end
	end)
end
-- I have seen this script so many times in many free models that
-- I don't know who made this in the first place, I just modified
-- some parts of the script to serve my purposes.


function onClicked(hit)
    print(hit.Name)
    print(hit.Character.Name)
	if hit.Character:findFirstChild("Humanoid") ~= nil and hit.Character:findFirstChild("Hat") == nil then
		local g = script.Parent.Parent.Hat:clone()
		g.Parent = hit.Character
		local C = g:GetChildren()
		for i=1, #C do
			if C[i].className == "Part" or C[i].className == "UnionOperation" or  C[i].className == "MeshPart" then
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				local CJ = CFrame.new(g.Middle.Position)
				local C0 = g.Middle.CFrame:inverse()*CJ
				local C1 = C[i].CFrame:inverse()*CJ
				W.C0 = C0
				W.C1 = C1
				W.Parent = g.Middle
			end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Character.Head
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, # h do
			if h[i].className == "Part" or C[i].className == "UnionOperation"  or C[i].className == "MeshPart" then
				h[i].Anchored = false
				h[i].CanCollide = false
			end
		end
		
	end
	
	--[[if hit.Character:findFirstChild("Humanoid") ~= nil and hit.Character:findFirstChild("Headgear") == nil then
		local g = script.Parent.Parent.Headgear:clone()
		g.Parent = hit.Character.Parent
		local C = g:GetChildren()
		for i=1, #C do
			if C[i].className == "Part" or C[i].className == "UnionOperation" or  C[i].className == "MeshPart" then
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				local CJ = CFrame.new(g.Middle.Position)
				local C0 = g.Middle.CFrame:inverse()*CJ
				local C1 = C[i].CFrame:inverse()*CJ
				W.C0 = C0
				W.C1 = C1
				W.Parent = g.Middle
			end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Parent.Head
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, # h do
			if h[i].className == "Part" or C[i].className == "UnionOperation" or  C[i].className == "MeshPart" then
				h[i].Anchored = false
				h[i].CanCollide = false
			end
		end
		
	end	]]--
	
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
-------- OMG HAX



r = game:service("RunService")


local damage = 0


local slash_damage = 0


sword = script.Parent.Handle
Tool = script.Parent



function attack()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end


function swordUp()
	Tool.GripForward = Vector3.new(-1,0,0)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
	Tool.GripForward = Vector3.new(0,0,1)
	Tool.GripRight = Vector3.new(0,-1,0)
	Tool.GripUp = Vector3.new(-1,0,0)
end



Tool.Enabled = true

function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	

	attack()

	wait(1)

	Tool.Enabled = true
end


function onEquipped()
	print("Running Delete")
end


script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
-- Naturally Aspirated Engine


Tune.Engine 		= true		

Tune.Horsepower		= 160
Tune.IdleRPM		= 1000
Tune.PeakRPM		= 11000
Tune.Redline		= 13000
Tune.EqPoint		= 9500
Tune.PeakSharpness	= 2
Tune.CurveMult		= 0.02
--[[
	Enables or disables character movement (eg. walking, jumping) based on the
	'isEnabled' argument.
	
	This function is called whenever the MerchBooth UI is opened or closed.
]]



local Players = game:GetService("Players")

local function setCharacterMovementEnabled(isEnabled: boolean)
	local playerModule = Players.LocalPlayer.PlayerScripts:FindFirstChild("PlayerModule")

	if playerModule then
		playerModule = require(playerModule)
		playerModule:GetControls():Enable(isEnabled)
	end
end

return setCharacterMovementEnabled
-- functions



local function CreateSquad(name)
	local squad		= script.Squad:Clone()
		squad.Name			= name and name or HttpService:GenerateGUID(false)
		squad.Queue.Value	= "Solo"
		squad.Fill.Value	= false
		squad.Parent		= SQUADS
		
	return squad
end

local function GetSquad(player)
	for _, squad in pairs(SQUADS:GetChildren()) do
		if squad.Players:FindFirstChild(player.Name) then
			return squad
		end
	end
end

local function RemovePlayer(player)
	for _, squad in pairs(SQUADS:GetChildren()) do
		local playerValue	= squad.Players:FindFirstChild(player.Name)
		
		if playerValue then
			playerValue:Destroy()
			
			if #squad.Players:GetChildren() == 0 then
				squad:Destroy()
			else
				if not squad.Players:FindFirstChild(squad.Leader.Value) then
					squad.Leader.Value	= squad.Players:GetChildren()[1].Name
				end
			end
			
			break
		end
	end
end

local function AddPlayerToSquad(player, squad)
	local currentSquad	= GetSquad(player)
	
	if currentSquad then
		RemovePlayer(player)
	end
	
	local playerValue	= Instance.new("BoolValue")
		playerValue.Name	= player.Name
		playerValue.Value	= false
		playerValue.Parent	= squad.Players
		
	if #squad.Players:GetChildren() == 1 then
		squad.Leader.Value	= player.Name
	elseif #squad.Players:GetChildren() > 1 then
		squad.Queue.Value	= "Squad"
	end
end

local function LeaveSquad(player)
	local squad	= CreateSquad()
	AddPlayerToSquad(player, squad)
	
	REMOTES.MatchInfo:FireClient(player, "Leave")
end
--[[Weight and CG]]


	Tune.Weight			= 2000		-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		6		,
	 --[[Height]]		4		,
	 --[[Length]]		15		}
	Tune.WeightDist		= 51		-- 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
-- Created by BobNoobington



local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local car = script.Parent.Car.Value
local values = script.Parent.Values.Gear

mouse.KeyDown:connect(function (key)
	key = string.lower(key)
	if key == "v" then
		for index, child in ipairs(script.Parent:GetChildren()) do
    		if child.ClassName == "Frame" or child.ClassName == "ImageLabel" then
				child.Visible = not child.Visible
			end
		end
	end
end)
--[[ I wont' be using promises for TopbarPlus so we can ignore this method
function Maid:givePromise(promise)
	if (promise:getStatus() ~= Promise.Status.Started) then
		return promise
	end

	local newPromise = Promise.resolve(promise)
	local id = self:giveTask(newPromise)

	-- Ensure GC
	newPromise:finally(function()
		self[id] = nil
	end)

	return newPromise, id
end--]]



function Maid:give(taskOrPromise)
	local taskId
	if type(taskOrPromise) == "table" and taskOrPromise.isAPromise then
		_, taskId = self:givePromise(taskOrPromise)
	else
		taskId = self:giveTask(taskOrPromise)
	end
	return taskOrPromise, taskId
end
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!


local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Baguette-- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)
-- Standard saving of data stores
-- The key you provide to DataStore2 is the name of the store with GetDataStore
-- GetAsync/UpdateAsync are then called based on the user ID


local DataStoreService = game:GetService("DataStoreService")
local Promise = require(script.Parent.Parent.Promise)

local Standard = {}
Standard.__index = Standard

function Standard:Get()
	return Promise.async(function(resolve)
		resolve(self.dataStore:GetAsync(self.userId))
	end)
end

function Standard:Set(value)
	return Promise.async(function(resolve)
		self.dataStore:UpdateAsync(self.userId, function()
			return value
		end)

		resolve()
	end)
end

function Standard.new(dataStore2)
	return setmetatable({
		dataStore = DataStoreService:GetDataStore(dataStore2.Name),
		userId = dataStore2.UserId,
	}, Standard)
end

return Standard
--[[Transmission]]


	Tune.TransModes		= {"Semi"}	--"Auto", "Semi", or "Manual". Can have more than one; order from first to last 
	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"	--"Speed" or "RPM"
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 2000		--Automatic downshift point (relative to peak RPM, positive = Under-rev)
	
	--Gear Ratios
	Tune.FinalDrive		= 3.97			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3.42		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		3.75		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.38		,
		--[[ 3 ]]		1.72		,
		--[[ 4 ]]		1.34		,
		--[[ 5 ]]		1.11		,
		--[[ 6 ]]		.95			,
		--[[ 7 ]]		.84			,
	}
	Tune.FDMult			= 1			--		-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
	Tune.FDMult			= 1			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
--Made by Luckymaxer



Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")
Debris = game:GetService("Debris")

RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create

Reindeer = require(script:WaitForChild("Reindeer"))

BaseUrl = "http://www.roblox.com/asset/?id="

BasePart = Create("Part"){
	Material = Enum.Material.Plastic,
	Shape = Enum.PartType.Block,
	TopSurface = Enum.SurfaceType.Smooth,
	BottomSurface = Enum.SurfaceType.Smooth,
	FormFactor = Enum.FormFactor.Custom,
	Size = Vector3.new(0.2, 0.2, 0.2),
	CanCollide = true,
	Locked = true,
}

Rate = (1 / 60)

ToolEquipped = false

Handle.Transparency = 0
Tool.Enabled = true

DisplayModel = Tool:FindFirstChild("DisplayModel")
if DisplayModel then
	DisplayModel:Destroy()
end

function RayCast(Position, Direction, MaxDistance, IgnoreList)
	local IgnoreList = ((type(IgnoreList) == "table" and IgnoreList) or {IgnoreList})
	return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList)
end

function SpawnReindeer(CreateNew)
	for i, v in pairs(Tool:GetChildren()) do
		if (v:IsA("Model") or v:IsA("BasePart")) and v ~= Handle then
			v:Destroy()
		end
	end
	if not CreateNew then
		return
	end
	local BeforeCFrame = Torso.CFrame
	local ReindeerCopy = Reindeer:Clone()
	local Body = ReindeerCopy.Body
	local TorsoWeld = Create("Weld"){
		Part0 = Torso,
		Part1 = Body,
		C0 = CFrame.new(-0.25, -0.3, -0.9),
		C1 = CFrame.new(0, 0, 0),
		Parent = Body
	}
	ReindeerCopy.Parent = Tool
	local RayHit, RayPos, RayNormal = RayCast(BeforeCFrame.p, Vector3.new(0, -1, 0), (Torso.Size.Y * 2), {Character})
	if RayHit then
		Torso.CFrame = (BeforeCFrame + Vector3.new(0, ((Torso.Size.Y / 2) + 2.5), 0))
		Torso.Velocity = Vector3.new(0, 0, 0)
		Torso.RotVelocity = Vector3.new(0, 0, 0)
	end
end

function CheckIfAlive()
	return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	Torso = Character:FindFirstChild("HumanoidRootPart")
	if not CheckIfAlive() then
		return
	end
	ToolEquipped = true
	Spawn(function()
		SpawnReindeer(true)
	end)
	Handle.Transparency = 1
end

function Unequipped()
	SpawnReindeer(false)
	ToolEquipped = false
	Handle.Transparency = 0
end

SpawnReindeer(false)

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
--[=[
	Disconnects all connected events to the signal. Voids the signal as unusable.
	Sets the metatable to nil.
]=]


function Signal:Destroy()
	if self._bindableEvent then
		-- This should disconnect all events, but in-flight events should still be
		-- executed.

		self._bindableEvent:Destroy()
		self._bindableEvent = nil
	end

	-- Do not remove the argmap. It will be cleaned up by the cleanup connection.

	setmetatable(self, nil)
end

return Signal
-- update stats loop


while true do
	
	for _, player in ipairs(game.Players:GetPlayers()) do
		local leaderstats = player:FindFirstChild("leaderstats")
		if not leaderstats then
			continue
		end
		
		for _, statObject in ipairs(leaderstats:GetChildren()) do
			local saveValue = trackedStats[statObject.Name](player)
			if not saveValue then
				continue
			end
			statObject.Value = saveValue
		end
	end
	
	wait(1)
end
--Horn Sound Code, Metrotren


m1=script.Parent.StartHorn
m2=script.Parent.HornSound
m3=script.Parent.EndHorn
m1:Stop() --Initial setup
m2:Stop()
m3:Stop()
m1.Volume = 0
m2.Volume = 0
m3.Volume = 0
m2.Looped = false
m2.Playing = false
script.Parent.Parent:WaitForChild("Drive").Locotrol.Event:connect(function(data)
	if data["Horn"] == true then
		m2.Volume = 0
		m2.Looped = false
		m2:Stop()
		m2.Playing = false
		m3.Volume = 0
		m3:stop()
		m1.Volume = 1
		m1:Play()
		--wait(m1.TimeLength) --disabled because it makes looping part stuck playing if stopped too soon.
		if m1.TimePosition < m1.TimeLength then
			m2.Looped = true
			m2.Volume = 1
			m2:Play()
		else
			m1.Volume = 0
			m1:Stop()
		end
	elseif data["Horn"] == false then
		m1.Volume = 0
		m1:Stop()
		--For 3 part option
		m2.Volume = 0
		m2:Stop()
		m2.Looped = false
		m2.Playing = false
		m3.Volume = 0
		m3:Play()
		
		--[[ -- For 2 part option
		if m2.IsPlaying == true then
			for i=1, 0, -.1 do
				m2.Volume = i*1
				wait(.1)
			end
		end
		m2.Volume = 0
		m2.Looped = false
		m2.Playing = false
		m2:Stop()
		--]]	
	end
end)
--[=[
	@param value T
	@return Option<T> | Option<None>

	Safely wraps the given value as an option. If the
	value is `nil`, returns `Option.None`, otherwise
	returns `Option.Some(value)`.
]=]


function Option.Wrap(value)
	if value == nil then
		return Option.None
	else
		return Option.Some(value)
	end
end