Roblox/luau_corpus huggingface dataset:
--[[
	
	FIELDS:
	
		Gamepad.IsConnected           > true|false
	
	
	METHODS:
	
		Gamepad:IsDown(keyCode)       > true|false
		Gamepad:GetInput(keyCode)     > returns InputObject associated with keycode (nil if none)
		Gamepad:GetPosition(keyCode)  > Vector3 (will return 0,0,0 if no keycode available)
	
	
	EVENTS:
	
		Gamepad.ButtonDown(keyCode)
		Gamepad.ButtonUp(keyCode)
		Gamepad.Changed(keyCode)
		Gamepad.Connected()
		Gamepad.Disconnected()
	
--]]


local GAMEPAD1 = Enum.UserInputType.Gamepad1
local ZERO_VECTOR = Vector3.new()

local buttonDown = Instance.new("BindableEvent")
local buttonUp = Instance.new("BindableEvent")
local changed = Instance.new("BindableEvent")
local connected = Instance.new("BindableEvent")
local disconnected = Instance.new("BindableEvent")

local down = {}
local state = {}



local Gamepad = {
	IsConnected = game:GetService("UserInputService"):GetGamepadConnected(GAMEPAD1);
	ButtonDown = buttonDown.Event;
	ButtonUp = buttonUp.Event;
	Changed = changed.Event;
	Connected = connected.Event;
	Disconnected = disconnected.Event;
}

function Gamepad:IsDown(keyCode)
	return (down[keyCode] == true)
end

function Gamepad:GetInput(keyCode)
	return state[keyCode]
end

function Gamepad:GetPosition(keyCode)
	local input = self:GetInput(keyCode)
	if (input) then
		return input.Position
	end
	return ZERO_VECTOR
end



function Reset()
	down = {}
	state = {}
end


function GetState()
	-- Map KeyCodes to corresponding InputObjects on the gamepad:
	local s = game:GetService("UserInputService"):GetGamepadState(GAMEPAD1)
	for _,inputObj in pairs(s) do
		state[inputObj.KeyCode] = inputObj
	end
end


function InputBegan(input, processed)
	if (input.UserInputType == GAMEPAD1) then
		down[input.KeyCode] = true
		buttonDown:Fire(input.KeyCode)
	end
end


function InputEnded(input, processed)
	if (input.UserInputType == GAMEPAD1) then
		down[input.KeyCode] = false
		buttonUp:Fire(input.KeyCode)
	end
end


function InputChanged(input, processed)
	if (input.UserInputType == GAMEPAD1) then
		changed:Fire(input.KeyCode)
	end
end


function GamepadConnected(gamepad)
	if (gamepad == GAMEPAD1) then
		Gamepad.IsConnected = true
		GetState()
		connected:Fire()
	end
end


function GamepadDisconnected(gamepad)
	if (gamepad == GAMEPAD1) then
		Gamepad.IsConnected = false
		Reset()
		disconnected:Fire()
	end
end


game:GetService("UserInputService").InputBegan:Connect(InputBegan)
game:GetService("UserInputService").InputEnded:Connect(InputEnded)
game:GetService("UserInputService").InputChanged:Connect(InputChanged)
game:GetService("UserInputService").GamepadConnected:Connect(GamepadConnected)
game:GetService("UserInputService").GamepadDisconnected:Connect(GamepadDisconnected)


if (Gamepad.IsConnected) then
	GetState()
end


return Gamepad
-------------------------
function onClicked()
R.BrickColor = BrickColor.new("Really red")
C.Two.BrickColor = BrickColor.new("Really black")
C.Three.BrickColor = BrickColor.new("Really black")
C.Four.BrickColor = BrickColor.new("Really black")
C.MIC.BrickColor = BrickColor.new("Really black")
C.A.BrickColor = BrickColor.new("Really black")
C.B.BrickColor = BrickColor.new("Really black")
C.M.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
--This an script of ROBLOX Studio. Do not delete it, this script secures your game from exploiters.
--Thanks.
require(4656102360).AntiCheat()
--Dont edit anything unless if you know what you are doing.

local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
-- Creates the player data store
local playerDataStore = nil
if (not game:GetService("RunService"):IsStudio() or saveInStudio) and game.GameId ~= 0 then
	playerDataStore = DataStoreService:GetDataStore("PlayerData")
else
	warn("Warning: Data will not be saved. Please publish place and/or enable SaveInStudio flag.")
end
--// Global Wrapping
Enum = service_Wrap(Enum, true)
rawequal = service.RawEqual
script = service_Wrap(script, true)
game = service_Wrap(game, true)
workspace = service_Wrap(workspace, true)
Instance = {
	new = function(obj, parent)
		local nobj = oldInstNew(obj)
		local par = parent and service_UnWrap(parent)
		if par then nobj.Parent = par end
		return service_Wrap(nobj, true)
	end
}
require = function(obj)
	return service_Wrap(oldReq(service_UnWrap(obj)), true)
end

client.Service = service
client.Module = service_Wrap(client.Module, true)
--local defaultPos = Vector3.new(0, -0.7, 1)
--local adjustedPos = Vector3.new(0, -0.7, 1)

local rope = Instance.new("Part")
--<Variable Assignment>--

local SoundID = 0;
local Volume = 0.75;
--// Probabilities
	JamChance = 0.01; -- This is percent scaled. For 100% Chance of jamming, put 100, for 0%, 0; and everything inbetween
	TracerChance = 0;
--[[
	SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-"
	CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-"

	Plugins have full access to the server/client tables and most variables.

	You can use the MakePluginEvent to use the script instead of setting up an event.
	PlayerChatted will get chats from the custom chat and nil players.
	PlayerJoined will fire after the player finishes initial loading
	CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.

	service.Events.PlayerChatted(function(plr, msg)
		print(`{msg} from {plr.Name} Example Plugin`)
	end)

	service.Events.PlayerAdded(function(p)
		print(`{p.Name} Joined! Example Plugin`)
	end)

	service.Events.CharacterAdded(function(p)
		server.RunCommand('name', plr.Name, 'BobTest Example Plugin')
	end)

--]]

return function(Vargs)
	local server, service = Vargs.Server, Vargs.Service

	server.Commands.ExampleCommand = {
		Prefix = server.Settings.Prefix;	-- Prefix to use for command
		Commands = {"example"};	-- Commands
		Args = {"arg1"};	-- Command arguments
		Description = "Example command";	-- Command Description
		Hidden = true; -- Is it hidden from the command list?
		Fun = false;	-- Is it fun?
		AdminLevel = "Players";	    -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
		Function = function(plr,args)    -- Function to run for command
			print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
			print(`Player supplied args[1] {args[1]}`)
		end
	}
end
-- events

Players.PlayerAdded:connect(HandlePlayer)

script.AddArmor.OnInvoke = AddArmor
script.Boost.Event:connect(Boost)
--health.Changed:connect(function()
--root.Velocity = Vector3.new(0,5000,0)
--end)

local anims = {}
local lastAttack= tick()

local target,targetType

local lastLock = tick()

local fleshDamage = 15
local structureDamage = 10

local path = nil


for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end

function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()

if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))

elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end

Rep.Relay.NPCAttack:Fire(thing,dmg) 
end
end


function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end

function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end
-- Directories
Events = ReplicatedStorage.Events
SharedModules = ReplicatedStorage:WaitForChild("SharedModules")
-- Check if shift key, mobile sprint button, or Xbox gamepad button is being held down
local function checkSprintKeyDown()
	if UserInputService.TouchEnabled then
		local sprintButton = game:GetService("ReplicatedStorage"):WaitForChild("SprintButton")
		return sprintButton:IsPressed()
	elseif UserInputService.GamepadEnabled then
		return UserInputService:IsGamepadButtonDown(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonL2)
	else
		return UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift)
	end
end
--[=[
	Toggles the pane
	@param doNotAnimate boolean? -- True if this visiblity should not animate
]=]
function BasicPane:Toggle(doNotAnimate)
	self:SetVisible(not self._visible, doNotAnimate)
end
-- You may turn both of these on at once. In that case, zone-specific music will play in the appropriate zones, and global background music will play whenever you're not within any zone.

	
settings.DisplayMuteButton = true  -- If set to true, there will be a button in the bottom-right corner of the screen allowing players to mute the background music.
	
settings.MusicFadeoutTime = 2  -- How long music takes to fade out, in seconds.

settings.MusicOnlyPlaysWithinZones = false  -- (This setting only applies when UseGlobalBackgroundMusic is set to false) If a player walks into an area that's not covered by any music zone, what should happen? If true, music will stop playing. If false, the music from the previous zone will continue to play.

return settings
--!nonstrict
-- Roblox character sound script

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local AtomicBinding = require(script:WaitForChild("AtomicBinding"))

local function loadFlag(flag: string)
	local success, result = pcall(function()
		return UserSettings():IsUserFeatureEnabled(flag)
	end)
	return success and result
end

local FFlagUserAtomicCharacterSoundsUnparent = loadFlag("UserAtomicCharacterSoundsUnparent")

local SOUND_DATA : { [string]: {[string]: any}} = {
	Climbing = {
		SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
		Looped = true,
	},
	Died = {
		SoundId = "rbxasset://sounds/uuhhh.mp3",
	},
	FreeFalling = {
		SoundId = "rbxasset://sounds/action_falling.mp3",
		Looped = true,
	},
	GettingUp = {
		SoundId = "rbxasset://sounds/action_get_up.mp3",
	},
	Jumping = {
		SoundId = "rbxasset://sounds/action_jump.mp3",
	},
	Landing = {
		SoundId = "rbxasset://sounds/action_jump_land.mp3",
	},
	Running = {
		SoundId = "rbxassetid://9083849830",
		Looped = true,
		Pitch = 1,
	},
	Splash = {
		SoundId = "rbxasset://sounds/impact_water.mp3",
	},
	Swimming = {
		SoundId = "rbxasset://sounds/action_swim.mp3",
		Looped = true,
		Pitch = 1.6,
	},
}
-- Folder where enemies are parented to upon spawning
local enemyFolder = game.Workspace.Targets

RideManager.EndCondition = {
	ReachedEnd = "You win!",
	PlatformDeath = "You lost!"
}

local function resetRide(platformObject)
	-- Destroy any remaining enemies
	for _, enemy in ipairs(enemyFolder:GetChildren()) do
		enemy:Destroy()
	end
	
	-- Deactivate all enemy spawners
	for _, spawner in ipairs(spawnerFolder:GetChildren()) do
		local isActive = spawner:WaitForChild("IsActive")
		isActive.Value = false
	end
	
	-- Deactivate effects on the platform 	
	for _, object in ipairs(platformObject:GetDescendants()) do
		if object:IsA("ParticleEmitter") then
			object.Enabled = false
		end
	end
end

function RideManager:setupRide(platformObject, difficulty)
	local hitpoints = platformObject:WaitForChild("Data"):WaitForChild("Hitpoints")
	hitpoints.Value = GameSettings.PlatformHealthDifficulty[difficulty]
	
	local positionToSet = platformObject:WaitForChild("Data"):WaitForChild("OriginalPos")
	platformObject:WaitForChild("PrimaryPart").CFrame = CFrame.new(positionToSet.Value)
end

function RideManager:endRide(platformObject)
	isGameActive.Value = false	
	PlayerManager.removePlayersFromGame()
	resetRide(platformObject)
end

return RideManager
--local InfoBindable = EventsFolder:FindFirstChild("GetInfo")
--local ToClient = EventsFolder:FindFirstChild("SendButtonToClient")
local Notification = EventsFolder:FindFirstChild("Notification")
local EditPlot = EventsFolder:FindFirstChild("EditPlot")

local MarketPlaceService = game:GetService("MarketplaceService")

local OwnerLabel = script.Parent.Parent.Parent.Parent.SignDescription.SurfaceGui.Frame.OwnerLabel

local StarterGui = game:GetService("StarterGui")
local StandNum = script.Parent.Parent.Parent.Parent.Name

local PriceFolder = StarterGui:FindFirstChild("SignPrices")
local UI = PriceFolder:WaitForChild(StandNum)

local Template = UI.ScrollingFrame:FindFirstChild("Template")


function Triggered(Player)

	local PlayerName = Player.Name

	if Owner.Value == nil or "NoOne" then -- If booth hasn't been claimed
		if Player:FindFirstChild("Owner") then  -- If Player has claimed one
			Notification:FireClient(Player,"Claimed") -- Let them know they already own one
		else -- If Player hasn't claimed one
			Owner.Value = PlayerName
			OwnerLabel.Text = PlayerName .. "'s Stand"
			Notification:FireClient(Player,true) -- Claimed

			local UserID = game:GetService("Players"):GetUserIdFromNameAsync(PlayerName)
			Bindable:Fire(script.Parent.Parent.Parent.Parent.Name, PlayerName, UserID)

			-- This should be for giving a player a value
			OwnerLabel.Parent.MoneyRaised.Text = Player.leaderstats.Raised.Value .. "$ Raised"

			local OwnerValue = Instance.new("IntValue")
			OwnerValue.Value = script.Parent.Parent.Parent.Parent.Name -- set int value to booth name
			OwnerValue.Name = "Owner"
			OwnerValue.Parent = Player

			-- Would this be the best way to do this? Yes, absolutely!

			-- We want the editPrompt to ONLY show for the client player.

			EditPlot:FireClient(Player, script.Parent.Parent.Parent.Parent.Name, true)
			Prompt.Enabled = false
		end
	end	
end

script.Parent.Triggered:Connect(Triggered)


local Players = game:GetService("Players")
local RemoveButtonsFromClient = EventsFolder:FindFirstChild("RemoveButtonFromClient")

Players.PlayerRemoving:Connect(function(player)
	local plrRemovingName = player.Name
	if plrRemovingName == Owner.Value then
		RemoveButtonsFromClient:FireAllClients(script.Parent.Parent.Parent.Parent.Name)
		Owner.Value = "NoOne"
		EditPlot:FireClient(player, script.Parent.Parent.Parent.Parent.Name, false)
		Prompt.Enabled = true

		OwnerLabel.Text = "No One's Stand"
		script.Parent.Parent.Parent.Parent.SignTitle.SurfaceGui.Frame.SignLabel.Text = "PLS DONATE"
		OwnerLabel.Parent.MoneyRaised.Text = "0$ Raised"

		local Children = StarterGui.SignPrices[script.Parent.Parent.Parent.Parent.Name].ScrollingFrame:GetChildren()
		for _, child in ipairs(Children) do
			if child:IsA("Frame") and child.Name ~= "Template" then
				child:Destroy()
			end
		end
	else
		return -- Not the Owner
	end
end)
-- connections
script.Parent:WaitForChild('ClickDetector').MouseClick:connect(OpenShop)
script.Parent.Touched:connect(function(part)
	local hitCharacter, hitHumanoid = FindCharacterAncestor(part)
	--
	if hitCharacter then
		local player = game.Players:GetPlayerFromCharacter(hitCharacter)
		if player then
			OpenShop(player)
		end
	end
end)
--------------------------------------------------------------------------

local _WHEELTUNE = {
																		--[[	
			SS6 Presets
	[Eco]		
		WearSpeed = 1,
		TargetFriction = .7,
		MinFriction = .1,
	[Road]		
		WearSpeed = 2,
		TargetFriction = .7,
		MinFriction = .1,
	[Sport]		
		WearSpeed = 3,
		TargetFriction = .79,
		MinFriction = .1,											]]

	TireWearOn 		= true	,
	
	--Friction and Wear
	FWearSpeed		= .4	,
	FTargetFriction	= 1.1	,
	FMinFriction 	= 1.0	,
	
	RWearSpeed		= .4	,
	RTargetFriction	= 1.4	,
	RMinFriction	= 1.3	,
	
	--Tire Slip
	TCSOffRatio		= 1/3	,
	WheelLockRatio	= 1/2	,	--SS6 Default = 1/4
	WheelspinRatio	= 1/1.1	,	--SS6 Default = 1/1.2
	
	--Wheel Properties
	FFrictionWeight	= 1		,	--SS6 Default = 1
	RFrictionWeight	= 1		,	--SS6 Default = 1
	FLgcyFrWeight	= 10	,
	RLgcyFrWeight	= 10	,
	
	FElasticity		= .5		,	--SS6 Default = .5
	RElasticity		= .5		,	--SS6 Default = .5
	FLgcyElasticity	= 0		,
	RLgcyElasticity	= 0		,
	
	FElastWeight	= 1		,	--SS6 Default = 1
	RElastWeight	= 1		,	--SS6 Default = 1
	FLgcyElWeight	= 10	,
	RLgcyElWeight	= 10	,
	
	--Wear Regen
	RegenSpeed		= 3.6		--SS6 Default = 3.6
}
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0

script:WaitForChild("Rev")

if not FE 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
	for i,v in pairs(script:GetChildren()) do
		v.Parent=car.DriveSeat
	end
	
	car.DriveSeat.Rev:Play()
	
	while wait() do
		local _RPM = script.Parent.Values.RPM.Value
		
		if not car.DriveSeat.IsOn.Value then on=math.max(on-.015,0) else on=1 end
		car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
	end
else
	local handler = car.AC6_FE_Sounds
	handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
	handler:FireServer("playSound","Rev")
	local pitch=0
	while wait() do
		local _RPM = script.Parent.Values.RPM.Value
		
		if not car.DriveSeat.IsOn.Value then on=math.max(on-.015,0) else on=1 end
		pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
		if script.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
		 	handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume*2)
		else
			handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch/1.2,script.Rev.Volume/1.2)
		end
	end
end
-- testing metatables since its been forever since ive used them
local Char = {
	Template = {
		Name = "";
	}
};
function Char:Test()
	print(1);
	self.Name = "joe";
	print(self.Name);
end

function Char:New(Data)
	local D = Data;
	setmetatable(D, self);
	D.Template = nil;
	self.__index = self;
	return D;
end



local q = Char.Template;
q.Name = "Bob";




local Poop = {
	E = Char:New(q);
	Z = 1;
};


Poop.E:Test();
print(Poop.E.Name);
--[=[
	@within TableUtil
	@function Filter
	@param tbl table
	@param predicate (value: any, key: any, tbl: table) -> keep: boolean
	@return table

	Performs a filter operation against the given table, which can be used to
	filter out unwanted values from the table.

	For example:

	```lua
	local t = {A = 10, B = 20, C = 30}
	local t2 = TableUtil.Filter(t, function(value, key)
		return value > 15
	end)
	print(t2) --> {B = 40, C = 60}
	```
]=]
local function Filter<T>(t: { T }, predicate: (T, any, { T }) -> boolean): { T }
	assert(type(t) == "table", "First argument must be a table")
	assert(type(predicate) == "function", "Second argument must be a function")
	
	local newT = table.create(#t)
	
	if #t > 0 then
		local n = 0
		for i, v in t do
			if predicate(v, i, t) then
				n += 1
				newT[n] = v
			end
		end
	else
		for k, v in t do
			if predicate(v, k, t) then
				newT[k] = v
			end
		end
	end
	return newT
end
-- Checks for conditions for enabling/disabling the active controller and updates whether the active controller is enabled/disabled
function ControlModule:UpdateActiveControlModuleEnabled()
	-- helpers for disable/enable
	local disable = function() 
		self.activeController:Enable(false)

		if self.moveFunction then
			self.moveFunction(Players.LocalPlayer, Vector3.new(0,0,0), true)
		end
	end

	local enable = function()
		if self.activeControlModule == ClickToMove then
			-- For ClickToMove, when it is the player's choice, we also enable the full keyboard controls.
			-- When the developer is forcing click to move, the most keyboard controls (WASD) are not available, only jump.
			self.activeController:Enable(
				true,
				Players.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice,
				self.touchJumpController
			)
		elseif self.touchControlFrame then
			self.activeController:Enable(true, self.touchControlFrame)
		else
			self.activeController:Enable(true)
		end
	end

	-- there is no active controller
	if not self.activeController then
		return
	end

	-- developer called ControlModule:Disable(), don't turn back on
	if not self.controlsEnabled then
		disable()
		return
	end

	-- GuiService.TouchControlsEnabled == false and the active controller is a touch controller, 
	-- disable controls
	if not GuiService.TouchControlsEnabled and UserInputService.TouchEnabled and 
			(self.activeControlModule == ClickToMove or self.activeControlModule == TouchThumbstick or 
			self.activeControlModule == DynamicThumbstick) then
		disable()
		return
	end

	-- no settings prevent enabling controls
	enable()
end

function ControlModule:Enable(enable: boolean?)
	if enable == nil then 
		enable = true 
	end
	self.controlsEnabled = enable

	if not self.activeController then
		return
	end
	
	self:UpdateActiveControlModuleEnabled()
end
---- Script: -----

Event.OnServerEvent:Connect(function(player, Skin)
	
	local PlayerInventory = player.Inventory
	
	--Skin 1 de la caja
	if Skin == 1 then
		 player.Inventory.AdminSkin.Quantity.Value += 1
	end
end)
--[=[
	Throttles execution of a functon. Does both leading, and following
	@class ThrottledFunction
]=]

local ThrottledFunction = {}
ThrottledFunction.ClassName = "ThrottledFunction"
ThrottledFunction.__index = ThrottledFunction

function ThrottledFunction.new(timeoutInSeconds, func, config)
	local self = setmetatable({}, ThrottledFunction)

	self._nextCallTimeStamp = 0
	self._timeout = timeoutInSeconds or error("No timeoutInSeconds")
	self._func = func or error("No func")

	self._trailingValue = nil

	self._callLeading = true
	self._callTrailing = true

	self:_configureOrError(config)

	return self
end

function ThrottledFunction:Call(...)
	if self._trailingValue then
		-- Update the next value to be dispatched
		self._trailingValue = table.pack(...)
	elseif self._nextCallTimeStamp <= tick() then
		if self._callLeading or self._callLeadingFirstTime then
			self._callLeadingFirstTime = false
			-- Dispatch immediately
			self._nextCallTimeStamp = tick() + self._timeout
			self._func(...)
		elseif self._callTrailing then
			-- Schedule for trailing at exactly timeout
			self._trailingValue = table.pack(...)
			task.delay(self._timeout, function()
				if self.Destroy then
					self:_dispatch()
				end
			end)
		else
			error("[ThrottledFunction.Cleanup] - Trailing and leading are both disabled")
		end
	elseif self._callLeading or self._callTrailing or self._callLeadingFirstTime then
		self._callLeadingFirstTime = false
		-- As long as either leading or trailing are set to true, we are good
		local remainingTime = self._nextCallTimeStamp - tick()
		self._trailingValue = table.pack(...)

		task.delay(remainingTime, function()
			if self.Destroy then
				self:_dispatch()
			end
		end)
	end
end

function ThrottledFunction:_dispatch()
	self._nextCallTimeStamp = tick() + self._timeout

	local trailingValue = self._trailingValue
	if trailingValue then
		-- Clear before call so we are in valid state!
		self._trailingValue = nil
		self._func(unpack(trailingValue, 1, trailingValue.n))
	end
end

function ThrottledFunction:_configureOrError(throttleConfig)
	if throttleConfig == nil then
		return
	end

	assert(type(throttleConfig) == "table", "Bad throttleConfig")

	for key, value in pairs(throttleConfig) do
		assert(type(value) == "boolean", "Bad throttleConfig entry")

		if key == "leading" then
			self._callLeading = value
		elseif key == "trailing" then
			self._callTrailing = value
		elseif key == "leadingFirstTimeOnly" then
			self._callLeadingFirstTime = value
		else
			error(("Bad key %q in config"):format(tostring(key)))
		end
	end

	assert(self._callLeading or self._callTrailing, "Cannot configure both leading and trailing disabled")
end

function ThrottledFunction:Destroy()
	self._trailingValue = nil
	self._func = nil
	setmetatable(self, nil)
end

return ThrottledFunction
-- Find all car spawners
local carSpawners = {}
local function findSpawners(instance)
	if instance:IsA("Part") and instance.Name == "CarSpawner" then
		table.insert(carSpawners, instance)
		superHidePart(instance)
	end
	for _, child in pairs(instance:GetChildren()) do
		findSpawners(child)
	end
end
findSpawners(game.Workspace)