Roblox/luau_corpus huggingface dataset:
-----------------------------------------------



function findAllFlagStands(root)
	local c = root:children()
	for i=1,#c do
		if (c[i].className == "Model" or c[i].className == "Part") then
			findAllFlagStands(c[i])
		end
		if (c[i].className == "FlagStand") then
			table.insert(stands, c[i])
		end
	end
end

function hookUpListeners()
	for i=1,#stands do
		stands[i].FlagCaptured:connect(onCaptureScored)
	end
end

function onPlayerEntered(newPlayer)

	if CTF_mode == true then

		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"

		local captures = Instance.new("IntValue")
		captures.Name = "Captures"
		captures.Value = 0


		captures.Parent = stats

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		stats.Parent = newPlayer

	else

		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"
		local kills = false
		if Settings.LeaderboardSettings.KOs then
			kills = Instance.new("IntValue")
			kills.Name = Settings.LeaderboardSettings.KillsName
			kills.Value = 0
		end
		local deaths = false
		if Settings.LeaderboardSettings.WOs then
			deaths = Instance.new("IntValue")
			deaths.Name = Settings.LeaderboardSettings.DeathsName
			deaths.Value = 0
		end
		
		local cash = false
		if Settings.LeaderboardSettings.ShowCurrency then
			cash = Instance.new("StringValue")
			cash.Name = Settings.CurrencyName
			cash.Value = 10000000
		end
		
		local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(newPlayer.Name)
		if PlayerStats ~= nil then
			if cash then
				local Short = Settings.LeaderboardSettings.ShowShortCurrency
				PlayerStats.Changed:connect(function()
					if (Short) then
						cash.Value = Settings:ConvertShort(PlayerStats.Value)
					else
						cash.Value = Settings:ConvertComma(PlayerStats.Value)
					end
				end)
			end
		end
		if kills then
		kills.Parent = stats
		end
		if deaths then
		deaths.Parent = stats
		end
		if cash then
		cash.Parent = stats
		end

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		local humanoid = newPlayer.Character.Humanoid

		humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )

		-- start to listen for new humanoid
		newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )


		stats.Parent = newPlayer

	end

end


function onCaptureScored(player)

		local ls = player:findFirstChild("leaderstats")
		if ls == nil then return end
		local caps = ls:findFirstChild("Captures")
		if caps == nil then return end
		caps.Value = caps.Value + 1

end


findAllFlagStands(game.Workspace)
hookUpListeners()
if (#stands > 0) then CTF_mode = true end
game.Players.ChildAdded:connect(onPlayerEntered)
--[[
	Called when the goal state changes value; this will initiate a new tween.
	Returns false as the current value doesn't change right away.
]]
function class:update()
	self._prevValue = self._currentValue
	self._nextValue = self._goalState:get(false)

	self._currentTweenStartTime = os.clock()
	self._currentTweenInfo = self._tweenInfo

	local tweenDuration = self._tweenInfo.DelayTime + self._tweenInfo.Time
	if self._tweenInfo.Reverses then
		tweenDuration += self._tweenInfo.Time
	end
	tweenDuration *= self._tweenInfo.RepeatCount
	self._currentTweenDuration = tweenDuration

	-- start animating this tween
	TweenScheduler.add(self)
	return false
end

if ENABLE_PARAM_SETTERS then

	--[[
		Specifies a new TweenInfo to use when the goal state changes in the future.
	]]
	function class:setTweenInfo(newTweenInfo: TweenInfo)
		self._tweenInfo = newTweenInfo
	end

end

local function Tween(goalState: Types.State<Types.Animatable>, tweenInfo: TweenInfo?)
	local currentValue = goalState:get(false)

	local self = setmetatable({
		type = "State",
		kind = "Tween",
		dependencySet = {[goalState] = true},
		-- if we held strong references to the dependents, then they wouldn't be
		-- able to get garbage collected when they fall out of scope
		dependentSet = setmetatable({}, WEAK_KEYS_METATABLE),
		_goalState = goalState,
		_tweenInfo = tweenInfo or TweenInfo.new(),

		_prevValue = currentValue,
		_nextValue = currentValue,
		_currentValue = currentValue,

		-- store current tween into separately from 'real' tween into, so it
		-- isn't affected by :setTweenInfo() until next change
		_currentTweenInfo = tweenInfo,
		_currentTweenDuration = 0,
		_currentTweenStartTime = 0
	}, CLASS_METATABLE)

	initDependency(self)
	-- add this object to the goal state's dependent set
	goalState.dependentSet[self] = true

	return self
end

return Tween
--// Connections
L_1_.Equipped:connect(function()
	local L_42_ = L_3_:FindFirstChild('Torso')
	local L_43_ = L_3_:FindFirstChild('Head')
	local L_44_ = L_3_:FindFirstChild('HumanoidRootPart')
	
	L_14_ = Instance.new("Motor6D", L_42_)
	L_14_.Parent = L_42_
	L_14_.Name = "Clone"
	L_14_.Part0 = L_44_
	L_14_.Part1 = L_43_
	L_14_.C0 = L_42_:WaitForChild("Neck").C0	
	L_14_.C1 = L_42_:WaitForChild("Neck").C1
--// Damage Settings	
	BaseDamage = 16; -- Torso Damage
	LimbDamage = 8; -- Arms and Legs
	ArmorDamage = 8; -- How much damage is dealt against armor (Name the armor "Armor")
	HeadDamage = 20; -- If you set this to 100, there's a chance the player won't die because of the heal script
--[=[
	Yields the current thread until the given Promise completes. Returns true if the Promise resolved, followed by the values that the promise resolved or rejected with.

	:::caution
	If the Promise gets cancelled, this function will return `false`, which is indistinguishable from a rejection. If you need to differentiate, you should use [[Promise.awaitStatus]] instead.
	:::

	```lua
		local worked, value = getTheValue():await()

	if worked then
		print("got", value)
	else
		warn("it failed")
	end
	```

	@yields
	@return boolean -- `true` if the Promise successfully resolved
	@return ...any -- The values the Promise resolved or rejected with.
]=]
function Promise.prototype:await()
	return awaitHelper(self:awaitStatus())
end

local function expectHelper(status, ...)
	if status ~= Promise.Status.Resolved then
		error((...) == nil and "Expected Promise rejected with no value." or (...), 3)
	end

	return ...
end
--[[
Creates a part.
--]]
local function CreatePart(Color,Size,CF,Parent)
	local Part = Instance.new("Part")
	Part.Color = Color
	Part.Material = "Plastic"
	Part.Size = Size
	Part.CFrame = CF
	Part.TopSurface = "Studs"
	Part.BottomSurface = "Inlet"
	Part.Parent = Parent
	
	return Part
end
-- Show where the red lines are going. You can change their colour and width in VisualizerCache
local SHOW_DEBUG_RAY_LINES: boolean = false
----------------------------------------------------------------------
--------------------[ BLOOD HANDLING ]--------------------------------
----------------------------------------------------------------------

local createBlood = script:WaitForChild("createBlood")
createBlood.OnServerEvent:connect(function(_, H, P, D, gunIgnore, S)
	local bloodCF = CF(P, P + D) * CFANG(RAD(-90), 0, 0)
	local Blood = Instance.new("Part")
	Blood.Transparency = 1
	Blood.Anchored = true
	Blood.CanCollide = false
	Blood.FormFactor = "Custom"
	Blood.Size = V3(0.2, 1, 0.2)
	Blood.TopSurface = 0
	Blood.BottomSurface = 0
	
	local Particles = Instance.new("ParticleEmitter")
	Particles.Color = ColorSequence.new(S.bloodSettings.Color)
	Particles.LightEmission = 0
	Particles.Size = NumberSequence.new(S.bloodSettings.Size)
	Particles.Texture = S.bloodSettings.Texture
	Particles.Transparency = NumberSequence.new(
		{
			NumberSequenceKeypoint.new(0, S.bloodSettings.startTransparency);
			NumberSequenceKeypoint.new(1, 1);
		}
	)
	Particles.EmissionDirection = Enum.NormalId.Top
	Particles.Lifetime = NumberRange.new(S.bloodSettings.Lifetime - 0.05, S.bloodSettings.Lifetime + 0.05)
	Particles.Rate = S.bloodSettings.Rate
	Particles.Rotation = NumberRange.new(0, 90)
	Particles.Speed = NumberRange.new(S.bloodSettings.Speed)
	Particles.VelocitySpread = S.bloodSettings.Spread
	Particles.Parent = Blood
	
	Blood.Parent = gunIgnore
	Blood.CFrame = bloodCF
	if (not H.Anchored) then
		local Weld = Instance.new("Weld", Blood)
		Weld.Part0 = H
		Weld.Part1 = Blood
		Weld.C0 = H.CFrame:toObjectSpace(bloodCF)
		Blood.Anchored = false
	end
	delay(0.15, function()
		Particles.Enabled = false
		wait(S.bloodSettings.Lifetime + 0.05)
		Blood:Destroy()
	end)
end)
--------------------
--| Script Logic |--
--------------------

Tool.Equipped:Connect(OnEquipped)
Tool.Activated:Connect(OnActivated)
--print("Keyframe : ".. frameName)
playToolAnimation(toolAnimName, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid) 
local roll = math.random(1, animTable[animName].totalWeight) 
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
--Stickmasterluke


sp=script.Parent


local h=sp:FindFirstChild("Humanoid")
local t=sp:FindFirstChild("Torso")
if h~=nil and t~=nil and h.Health>0 then
	local f=Instance.new("Fire")
	f.Color=Color3.new(1,0,0)
	f.SecondaryColor=Color3.new(1,1,1)
	f.Size=3
	f.Heat=2
	f.Parent=t
	if f~=nil then
		f:remove()
	end
end
script:remove()
--Close/Store Wear Data
car.DriveSeat.ChildRemoved:connect(function(child)
	if child.Name=="SeatWeld" then
		local wD=car:FindFirstChild("WearData")
		if car:FindFirstChild("WearData")==nil then
			wD = script.Parent.WearData:Clone()
			wD.Parent=car
		end
		for i,v in pairs(Wheels) do
			wD[v.wheel.Name].Value = v.Heat
		end
		wD.STime.Value=tick()
	end
end)
--// Firemode Settings
	CanSelectFire = true;
	BurstEnabled = false;
	SemiEnabled = true;
	AutoEnabled = false;
	BoltAction = false;
	ExplosiveEnabled = false;
-- services
local players = game:GetService("Players")
local text_service = game:GetService("TextService")
local tween_service = game:GetService("TweenService")
-- emote bindable hook
if FFlagAnimateScriptEmoteHook then
	script:WaitForChild("PlayEmote").OnInvoke = function(emote)
		-- Only play emotes when idling
		if pose ~= "Standing" then
			return
		end

		if emoteNames[emote] ~= nil then
			-- Default emotes
			playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)

			return true
		elseif typeof(emote) == "Instance" and emote:IsA("Animation") then
			-- Non-default emotes
			playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)
			return true
		end

		-- Return false to indicate that the emote could not be played
		return false
	end
end
-- Libraries
local Roact = require(Vendor:WaitForChild('Roact'))
--[[
	    ___      _______                _       _______
	   / _ |____/ ___/ /  ___ ____ ___ (_)__   /__  __/
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<     / /
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/	/_/   
						SecondLogic @ Inspare
						Avxnturador @ Novena
]]
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local BOVact = 0
local BOVact2 = 0
--[[**
	ensures Roblox Vector3int16 type

	@param value The value to check against

	@returns True iff the condition is satisfied, false otherwise
**--]]
t.Vector3int16 = primitive("Vector3int16")
-- << MORPHS >>
function module:CreateMorphs()
	main:GetModule("cf"):ClearPage(pages.morphs)
	
	--Organise morphs
	local morphsList = {}
	local searchText = frame.SearchBar.Frame.TextBox.Text
	for morphName,_ in pairs(main.morphNames) do
		local cName = string.lower(morphName)
		if string.match(cName, searchText) then
			table.insert(morphsList, morphName)
		end
	end
	table.sort(morphsList)
	table.insert(morphsList, 1, main.pdata.Prefix.. "morph <player> <morphName>")
				
	--Create morph labels
	for i,morphName in pairs(morphsList) do
		local label = templateM:Clone()
		if i == 1 then
			label.BackgroundColor3 = Color3.fromRGB(95, 95, 95)
			label.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
		else
			label.BackgroundColor3 = main:GetModule("cf"):GetLabelBackgroundColor(i)
			label.TextLabel.TextColor3 = Color3.fromRGB(235, 235, 235)
		end
		label.TextLabel.Text = morphName
		label.Name = morphName
		label.Visible = true
		label.Parent = pages.morphs
	end
	
	--Canvas size
	pages.morphs.CanvasSize = UDim2.new(0,0,0,#morphsList*templateM.AbsoluteSize.Y)
end
--- Send text as the local user to remote server to be evaluated there.
function Dispatcher:Send (text, data)
	if RunService:IsClient() == false then
		error("Dispatcher:Send can only be called from the client.")
	end

	return self.Cmdr.RemoteFunction:InvokeServer(text, data)
end
-- functions
local function generate_number_range(from, to, seperator)
	local numbers = {}

	for i = from, to, if (from < to) then 1 else -1 do
		table.insert(numbers, i .. if (seperator and i ~= to) then seperator else "")
	end

	return table.concat(numbers)
end
--[[**
	Returns a t.union of each key in the table as a t.literal

	@param keyTable The table to get keys from

	@returns True iff the condition is satisfied, false otherwise
**--]]
function t.keyOf(keyTable)
	local keys = {}
	for key in pairs(keyTable) do
		keys[#keys + 1] = key
	end
	return t.literal(unpack(keys))
end
--// Connections
L_101_.OnClientEvent:connect(function(L_180_arg1, L_181_arg2, L_182_arg3, L_183_arg4, L_184_arg5, L_185_arg6, L_186_arg7)
	if L_180_arg1 and not L_15_ then
		MakeFakeArms()
		
		L_41_ = L_21_:WaitForChild('MainGui'):clone()
		L_41_.Parent = L_2_.PlayerGui
		L_26_ = L_41_:WaitForChild('Others')
		L_27_ = L_26_:WaitForChild('Kill')
		L_28_ = L_41_:WaitForChild('GameGui'):WaitForChild('AmmoFrame')
		L_29_ = L_28_:WaitForChild('Ammo')
		L_30_ = L_28_:WaitForChild('AmmoBackground')
		L_31_ = L_28_:WaitForChild('MagCount')
		L_32_ = L_28_:WaitForChild('MagCountBackground')
		L_33_ = L_28_:WaitForChild('DistDisp')
		L_34_ = L_28_:WaitForChild('Title')
		L_35_ = L_28_:WaitForChild('Mode1')
		L_36_ = L_28_:WaitForChild('Mode2')
		L_37_ = L_28_:WaitForChild('Mode3')
		L_38_ = L_28_:WaitForChild('Mode4')
		L_39_ = L_28_:WaitForChild('Mode5')
		L_40_ = L_28_:WaitForChild('Stances')
		
		L_34_.Text = L_1_.Name
		UpdateAmmo()
		
		L_42_ = L_181_arg2
		L_43_ = L_182_arg3
		L_44_ = L_183_arg4
		L_45_ = L_184_arg5
		L_46_ = L_185_arg6
		L_47_ = L_186_arg7	
		L_48_ = L_58_.Bolt
		
		L_82_ = L_47_.C1
		L_83_ = L_47_.C0
		
		if L_1_:FindFirstChild('AimPart2') then
			L_53_ = L_1_:WaitForChild('AimPart2')
		end
		
		if L_1_:FindFirstChild('FirePart2') then
			L_56_ = L_1_.FirePart2
		end
		
		if L_24_.FirstPersonOnly then
			L_2_.CameraMode = Enum.CameraMode.LockFirstPerson
		end
		--uis.MouseIconEnabled = false
		L_5_.FieldOfView = 70
		L_15_ = true
	elseif L_15_ then
		if L_3_ and L_3_.Humanoid and L_3_.Humanoid.Health > 0 and L_9_ then
			Stand()
			Unlean()
		end	
		
		L_88_ = 0
		L_75_ = false
		L_76_ = false
		L_77_ = false
		L_60_ = false
		L_63_ = false
		L_62_ = false
		Shooting = false
		
		L_92_ = 70
		
		RemoveArmModel()
		
		L_41_:Destroy()	
		
		if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
			L_3_['Right Arm'].LocalTransparencyModifier = 0
			L_3_['Left Arm'].LocalTransparencyModifier = 0
		end	

		L_74_ = false
		L_65_ = true
		
		L_2_.CameraMode = Enum.CameraMode.Classic
		L_100_.MouseIconEnabled = true		
		L_5_.FieldOfView = 70
		L_15_ = false
		L_100_.MouseDeltaSensitivity = L_51_
		L_4_.Icon = "http://www.roblox.com/asset?id=0"
		L_15_ = false
	end
end)
--[[
	Fires when the local player begins input. Ignores all input except if
	the user presses `KEY`. If `KEY` is pressed opens the game GUI unless
	player already interacting with the game

	Arguments: 
		actionName - Name of the ContextActionService action
		userInputState - State of input
		inputObject - Contains info about input
	Returns: None
]]--
local function toggleKeyboard(actionName, userInputState, inputObject)
	if not (userInputState == Enum.UserInputState.Begin) then return end
	toggleInteraction()
end
local function toggleMouse(playerWhoClicked)
	if playerWhoClicked then
		toggleInteraction()
	end
end
-- Gamepad / Keyboard Support
TextBox.SelectionGained:Connect(onFocused)
TextBox.SelectionLost:Connect(onFocusLost)
-- Variables (best not to touch these!)
local button = script.Parent 
local car = script.Parent.Parent.Car.Value
local sound = script.Parent.Start
sound.Parent = car.DriveSeat -- What brick the start sound is playing from.
button.MouseButton1Click:connect(function() -- Event when the button is clicked
	if script.Parent.Text == "Engine: Off" then -- If the text says it's off then..
		sound:Play() -- Startup sound plays..
		wait(0.4) -- For realism. Okay?
		script.Parent.Parent.IsOn.Value = true -- The car is is on, or in other words, start up the car.
		button.Text = "Engine: On"  -- You don't really need this, but I would keep it.
	else -- If it's on then when you click the button,
		script.Parent.Parent.IsOn.Value = false -- The car is turned off.
		button.Text = "Engine: Off"
	end -- Don't touch this.
end) -- And don't touch this either.
--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
--Stickmasterluke


sp=script.Parent


taseduration=7
rate=.5


local s=Instance.new("Sound")
s.SoundId="http://www.roblox.com/asset/?id=82277505"
s.Looped=true

joints={}
local t=sp:FindFirstChild("HumanoidRootPart")
if t~=nil then
	s.Parent=t
	s:Play()
	for i,v in ipairs(t:GetChildren()) do
		if v.className=="Motor" or v.className=="Motor6D" or v.className=="Weld" or v.className=="ManualWeld" then
			table.insert(joints,v)
		end
	end
end

if #joints>=1 then
	local trippy = script.Trippy:Clone()
	trippy.Parent = sp:FindFirstChild'Humanoid'
	trippy.Disabled = false
	for i=1,taseduration/rate do
		for i,v in ipairs(joints) do
			if v~=nil then
				v.CurrentAngle=(math.random()-.5)*5
			end
		end
		local h=sp:FindFirstChild("Humanoid")
		local t=sp:FindFirstChild("HumanoidRootPart")
		if t~=nil and h~=nil then
			--t.RotVelocity = Vector3.new(math.random()-.5,math.random()-.5,math.random()-.5)*2*360
			wait(rate)
		end
	end
	trippy:Destroy()
end
s:Stop()
script:remove()
--[[
	Stringifies a number and places a separator between thousands.


	```lua
	separateThousands(1000000) -- 1,000,000
	separateThousands(12345678, ".") -- 12.345.678
	```

	This function is called when setting the text for the PrimaryButton
	component when in Purchase mode; the text reflects the price in Robux.

	@within Modules
]]

local function separateThousands(n: number, sep: string?): string
	sep = sep or ","

	local str = tostring(n)

	-- Reverse to apply commas from right-to-left of the original number.
	str = str:reverse():gsub("%d%d%d", "%1,")

	-- Reverse back to normal and trim off any leading commas. The trim is
	-- needed when the number of digits is divisible by 3.
	str = str:reverse():gsub("^,", "")

	return str
end

return separateThousands
--[[Brakes]]
	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 2500		-- Front brake force
	Tune.RBrakeForce	= 1500		-- Rear brake force
	Tune.PBrakeForce	= 10000		-- Handbrake force
	
	Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
--------------------------------------------------------------------------------
-- Piercing raycasts

local function getCollisionPoint(origin, dir)
	local originalSize = #blacklist
	repeat
		local hitPart, hitPoint = workspace:FindPartOnRayWithIgnoreList(
			ray(origin, dir), blacklist, false, true
		)

		if hitPart then
			if hitPart.CanCollide then
				eraseFromEnd(blacklist, originalSize)
				return hitPoint, true
			end
			blacklist[#blacklist + 1] = hitPart
		end
	until not hitPart

	eraseFromEnd(blacklist, originalSize)
	return origin + dir, false
end
--[[Susupension]]
	Tune.SusEnabled		= true		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
	
	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 5000		-- Spring Force
	Tune.FSusLength		= 3.6			-- Suspension length (in studs)
	Tune.FSusMaxExt		= .5		-- Max Extension Travel (in studs)
	Tune.FSusMaxComp	= 1.2		-- 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	= 5000		-- Spring Force
	Tune.RSusLength		= 3.5			-- Suspension length (in studs)
	Tune.RSusMaxExt		= .5		-- Max Extension Travel (in studs)
	Tune.RSusMaxComp	= 1.2		-- 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		= false			-- 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