Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 700		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 920		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 11000		--		Use sliders to manipulate values
	Tune.Redline		= 14000		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 1.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
--[[Status Vars]]



local _IsOn = _Tune.AutoStart
if _Tune.AutoStart then script.Parent.IsOn.Value=true end

local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _GBrake=0

local _ClutchOn = true
local _ClPressing = false
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _spLimit = 0

local _TMode = _Tune.TransModes[1]

local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _ABS = _Tune.ABSEnabled
local _ABSActive = false

local FlipWait=tick()
local FlipDB=false

local _InControls = false
-- tableUtil.Assign(Table target, ...Table sources)


local function Assign(target, ...)
	for _,src in ipairs({...}) do
		for k,v in pairs(src) do
			target[k] = v
		end
	end
	return target
end


local function Print(tbl, label, deepPrint)

	assert(type(tbl) == "table", "First argument must be a table")
	assert(label == nil or type(label) == "string", "Second argument must be a string or nil")
	
	label = (label or "TABLE")
	
	local strTbl = {}
	local indent = " - "
	
	-- Insert(string, indentLevel)
	local function Insert(s, l)
		strTbl[#strTbl + 1] = (indent:rep(l) .. s .. "\n")
	end
	
	local function AlphaKeySort(a, b)
		return (tostring(a.k) < tostring(b.k))
	end
	
	local function PrintTable(t, lvl, lbl)
		Insert(lbl .. ":", lvl - 1)
		local nonTbls = {}
		local tbls = {}
		local keySpaces = 0
		for k,v in pairs(t) do
			if (type(v) == "table") then
				table.insert(tbls, {k = k, v = v})
			else
				table.insert(nonTbls, {k = k, v = "[" .. typeof(v) .. "] " .. tostring(v)})
			end
			local spaces = #tostring(k) + 1
			if (spaces > keySpaces) then
				keySpaces = spaces
			end
		end
		table.sort(nonTbls, AlphaKeySort)
		table.sort(tbls, AlphaKeySort)
		for _,v in pairs(nonTbls) do
			Insert(tostring(v.k) .. ":" .. (" "):rep(keySpaces - #tostring(v.k)) .. v.v, lvl)
		end
		if (deepPrint) then
			for _,v in pairs(tbls) do
				PrintTable(v.v, lvl + 1, tostring(v.k) .. (" "):rep(keySpaces - #tostring(v.k)) .. " [Table]")
			end
		else
			for _,v in pairs(tbls) do
				Insert(tostring(v.k) .. ":" .. (" "):rep(keySpaces - #tostring(v.k)) .. "[Table]", lvl)
			end
		end
	end
	
	PrintTable(tbl, 1, label)
	
	print(table.concat(strTbl, ""))
	
end


local function IndexOf(tbl, item)
	for i = 1,#tbl do
		if (tbl[i] == item) then
			return i
		end
	end
	return nil
end


local function Reverse(tbl)
	local n = #tbl
	local tblRev = table.create(n)
	for i = 1,n do
		tblRev[i] = tbl[n - i + 1]
	end
	return tblRev
end


local function Shuffle(tbl)
	assert(type(tbl) == "table", "First argument must be a table")
	local rng = Random.new()
	for i = #tbl, 2, -1 do
		local j = rng:NextInteger(1, i)
		tbl[i], tbl[j] = tbl[j], tbl[i]
	end
end


local function IsEmpty(tbl)
	return (next(tbl) == nil)
end


local function EncodeJSON(tbl)
	return http:JSONEncode(tbl)
end


local function DecodeJSON(str)
	return http:JSONDecode(str)
end


local function FastRemoveFirstValue(t, v)
	local index = IndexOf(t, v)
	if (index) then
		FastRemove(t, index)
		return true, index
	end
	return false, nil
end


TableUtil.Copy = CopyTable
TableUtil.CopyShallow = CopyTableShallow
TableUtil.Sync = Sync
TableUtil.FastRemove = FastRemove
TableUtil.FastRemoveFirstValue = FastRemoveFirstValue
TableUtil.Print = Print
TableUtil.Map = Map
TableUtil.Filter = Filter
TableUtil.Reduce = Reduce
TableUtil.Assign = Assign
TableUtil.IndexOf = IndexOf
TableUtil.Reverse = Reverse
TableUtil.Shuffle = Shuffle
TableUtil.IsEmpty = IsEmpty
TableUtil.EncodeJSON = EncodeJSON
TableUtil.DecodeJSON = DecodeJSON


return TableUtil
--[[Steering]]


	Tune.SteerInner		= 49		-- Inner wheel steering angle (in degrees)
	Tune.SteerOuter		= 50		-- Outer wheel steering angle (in degrees)
	Tune.SteerSpeed		= .02		-- Steering increment per tick (in degrees)
	Tune.ReturnSpeed	= .1		-- Steering increment per tick (in degrees)
	Tune.SteerDecay		= 320		-- Speed of gradient cutoff (in SPS)
	Tune.MinSteer		= 10		-- Minimum steering at max steer decay (in percent)
	Tune.MSteerExp		= 1			-- Mouse steering exponential degree
	
	--Steer Gyro Tuning
	Tune.SteerD			= 1000		-- Steering Dampening
	Tune.SteerMaxTorque	= 50000		-- Steering Force
	Tune.SteerP			= 100000	-- Steering Aggressiveness
-- options -------------------------



setupmode = "Auto" -- Manual or Auto (if you want to pick what plugins you have yourself or you want it to be automated)
soundplugin = "StockSound"	-- StockSound, SoundSuite or 1.5 Sound (no others are supported, sorry!) (MANUAL ONLY)
camkey = "v" -- the key you use for first person camera
level = 28 -- 0% - 100% 
exceptions = {"Horn","Engine","Ignition","Smoke"} -- put names of audios to ignore here (AUTO ONLY)
--[=[
	@param name string
	@param priority number
	@param fn (dt: number) -> nil
	Calls `RunService:BindToRenderStep` and registers a function in the
	Janitor that will call `RunService:UnbindFromRenderStep` on cleanup.

	```lua
	Janitor:BindToRenderStep("Test", Enum.RenderPriority.Last.Value, function(dt)
		-- Do something
	end)
	```
]=]


function Janitor:BindToRenderStep(name: string, priority: number, fn: (dt: number) -> nil)
	RunService:BindToRenderStep(name, priority, fn)
	self:Add(function()
		RunService:UnbindFromRenderStep(name)
	end)
end
--[[
	
	Plays an animation on humanoid/character/player. Returns {animationTrack, animation}
	
	Functions.Animation(
		id,						<-- |REQ| 	Animation ID
		instance,				<-- |REQ|	Player/character/humanoid		
	)
	
--]]




return function(id, parent)
	local humanoid
	
	--- Get humanoid
	if parent.ClassName == "Humanoid" then
		humanoid = parent
	elseif parent:FindFirstChildOfClass("Humanoid") then
		humanoid = parent:FindFirstChildOfClass("Humanoid")
	elseif parent.ClassName == "Player" then
		humanoid = parent.Character:FindFirstChild("Humanoid")
	end
	
	--- Play animation
	if humanoid then
		local animation = Instance.new("Animation")
		animation.AnimationId = "rbxassetid://" .. id
		--
		local track = humanoid:LoadAnimation(animation)
		track:Play()
		--
		return track
	end
end
--local Part = script.Parent
--local Org = Part.Position



local rate = 1 / 30

local frames = Time.Value / rate

for frame = 1, frames do
	wait(rate)
	
	local percent = frame / frames
	--Part.Position = Org + Vector3.new(0, 5 * percent, 0)
	Lbl.Value.Parent.StudsOffset = Lbl.Value.Parent.StudsOffset + Vector3.new(0, 0.2, 0)
	Lbl.Value.TextTransparency = percent
	Lbl.Value.TextStrokeTransparency = percent
end
-- If gun has more than one part undisable this and it will weld everything for you!


function Weld(p0,p1)
local weld = Instance.new('Weld')
weld.Part0 = p0
weld.Part1 = p1
weld.C0 = p0.CFrame:inverse()*CFrame.new(p0.Position)
weld.C1 = p1.CFrame:inverse()*CFrame.new(p0.Position)
weld.Parent = p0
end

function WeldIt(obj) if obj then
if obj:IsA('BasePart') then Weld(script.Parent.Handle,obj) end
for i,v in pairs(obj:children()) do WeldIt(v) end
end
end

script.Parent.Equipped:connect(function() WeldIt(script.Parent) end)
script.Parent.Unequipped:connect(function() WeldIt(script.Parent) end)
WeldIt(script.Parent)
--Made by Superluck, Uploaded by FederalSignal_QCB. and Dalek For the Amps
--Made by Superluck, Uploaded by FederalSignal_QCB. and Dalek For the Amps
--Made by Superluck, Uploaded by FederalSignal_QCB. and Dalek For the Amps


script.Parent.Material = Enum.Material.Glass
script.Parent.Parent.Parent.On.Changed:Connect(function()
if script.Parent.Parent.Parent.On.Value == true then
script.Parent.Material = Enum.Material.Neon
else 
script.Parent.Material = Enum.Material.Glass
end
end)
--]]


primaryWeaponSlot.ChildAdded:Connect(function(newChild)
	weapon1Label.BackgroundColor3 = offColor
	weapon1Label.Text = newChild.Name
end)
secondaryWeaponSlot.ChildAdded:Connect(function(newChild)
	weapon2Label.BackgroundColor3 = offColor
	weapon2Label.Text = newChild.Name
end)
tertiaryWeaponSlot.ChildAdded:Connect(function(newChild)
	weapon3Label.BackgroundColor3 = offColor
	weapon3Label.Text = newChild.Name
end)
-------------------------


function onClicked()
R.Function1.Disabled = true

FX.ROLL.BrickColor = BrickColor.new("CGA brown")
FX.ROLL.loop.Disabled = true

FX.REVERB.BrickColor = BrickColor.new("CGA brown")
FX.REVERB.loop.Disabled = true

FX.GATE.BrickColor = BrickColor.new("CGA brown")
FX.GATE.loop.Disabled = true

FX.PHASER.BrickColor = BrickColor.new("CGA brown")
FX.PHASER.loop.Disabled = true

FX.SLIPROLL.BrickColor = BrickColor.new("CGA brown")
FX.SLIPROLL.loop.Disabled = true

FX.FILTER.BrickColor = BrickColor.new("CGA brown")
FX.FILTER.loop.Disabled = true

FX.SENDRETURN.BrickColor = BrickColor.new("Really red")
FX.SENDRETURN.loop.Disabled = true

FX.TRANS.BrickColor = BrickColor.new("CGA brown")
FX.TRANS.loop.Disabled = true

FX.MultiTapDelay.BrickColor = BrickColor.new("CGA brown")
FX.MultiTapDelay.loop.Disabled = true

FX.DELAY.BrickColor = BrickColor.new("CGA brown")
FX.DELAY.loop.Disabled = true

FX.ECHO.BrickColor = BrickColor.new("CGA brown")
FX.ECHO.loop.Disabled = true
R.loop.Disabled = false
R.Function2.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
--		print("Keyframe : ".. frameName)


		local repeatAnim = stopToolAnimations()
		playToolAnimation(repeatAnim, 0.0, Humanoid)
	end
end

function playToolAnimation(animName, transitionTime, humanoid)
	if animName ~= toolAnimName then
		if toolAnimTrack then
			toolAnimTrack:Stop()
			toolAnimTrack:Destroy()
			transitionTime = 0
		end
		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
-- This script only needs to run if increment values actually exist.


if earnTime > 0 and earnAmount ~= 0 then
	-- The first shop in the game that loads will parent this script to
	-- ServerScriptService. After that, the other shops will just change
	-- the value of playerObject, and the player gets added to the increment list.
	script.playerObject.Changed:connect(function(value)
		if value and value:IsA("Player") then
			for _, player in next, playersToIncrement do
				if player == value then return end
			end
			table.insert(playersToIncrement, value)
		end
		script.playerObject.Value = nil
	end)

	while wait(earnTime) and wait() do
		for i, player in next, playersToIncrement do
			if player then
				local cash = player.leaderstats:FindFirstChild(cashName)
				if cash then
					cash.Value = cash.Value + earnAmount
				end
			else
				table.remove(playersToIncrement, i)
			end
		end
	end
else
	script:Destroy()
end
--// Recoil Settings	


	gunrecoil = -0.3; -- How much the gun recoils backwards when not aiming
	camrecoil = 0.05; -- How much the camera flicks when not aiming
	AimGunRecoil = -0.1; -- How much the gun recoils backwards when aiming
	AimCamRecoil = 0.02; -- How much the camera flicks when aiming
	
	CamShake = 56; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
	AimCamShake = 38; -- THIS IS ALSO NEW!!!!
	
	Kickback = 3; -- Upward gun rotation when not aiming
	AimKickback = 0.1; -- Upward gun rotation when aiming
-- Driver Input Loop --


while script.Parent ~= nil do
	--Update throttle, steer, handbrake
	getInputValues()

	local currentVel = Chassis.GetAverageVelocity()

	local steer = script.Steering.Value
	Chassis.UpdateSteering(steer, currentVel)

	-- Taking care of throttling
	local throttle = script.Throttle.Value
	script.AngularMotorVelocity.Value = currentVel
	script.ForwardVelocity.Value = DriverSeat.CFrame.LookVector:Dot(DriverSeat.Velocity)
	Chassis.UpdateThrottle(currentVel, throttle)

	-- Taking care of handbrake
	if script.HandBrake.Value > 0 then
		Chassis.EnableHandbrake()
	end
	wait()
end
-- LIGHT SETTINGS
--[[
	LIGHT TYPES:
		- Halogen
		- LED
]]

--

local Low_Beam_Brightness = 0.55

local High_Beam_Brightness = 0.80

local Fog_Light_Brightness = 0.7

local Rear_Light_Brightness = 1.0

local Brake_Light_Brightness = 1.5

local Reverse_Light_Brightness = 1

local Headlight_Type = "Halogen"

local Indicator_Type = "Halogen"

local Fog_Light_Type = "Halogen"

local Plate_Light_Type = "Halogen"

local Rear_Light_Type = "Halogen"

local Reverse_Light_Type = "Halogen"

local Running_Light_Location = "Custom DRL" -- Where your running lights will luminate. ("Low Beam / Indicators" and "Low Beam".  LED DRLS or any DRL in a differnet position go in the Running model, change the string to "Custom DRL")

local CustomDRL_Type = "LED"

local Fade_Time = 0.35 -- How long it takes for the light to fully turn on. (works only with Halogen, default is 0.35 seconds)

local Indicator_Flash_Rate = 0.3 -- Rate of change between each indicator state. (in seconds)

local Popup_Hinge_Angle = -0.75 -- Changes the angle of your popup headlights. (only use if your car has popups)
--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 = true
	Object.Sparks.Enabled = false
	Object.Orientation = Vector3.new(0,0,0)
	Object.Transparency = 1
	Object.Fuse:Stop()
	Object.Explode:Play()
	Object.Explosion:Emit(100)
	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()
---Finds the characters position, based off their torso


local t = P.Character:FindFirstChild("Torso")
if t then
local Char = P.Character
local X = Char.Torso.Position.X
local Y = Char.Torso.Position.Y
local Z = Char.Torso.Position.Z

local X1 = Instance.new("IntValue")
X1.Value = X
local Y1 = Instance.new("IntValue")
Y1.Value = Y
local Z1 = Instance.new("IntValue")
Z1.Value = Z

script.Parent.Text = " " ..X1.Value.. ", " ..Y1.Value.. ", " ..Z1.Value.. " "
end
end
wait(T)
end
--		print(animName .. " " .. idx .. " [" .. origRoll .. "]")


		local anim = animTable[animName][idx].anim

		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		 
		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName

		-- set up keyframe name triggers
		if currentAnimKeyframeHandler then
			currentAnimKeyframeHandler:disconnect()
		end
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
	end
end
---Box thing


for _,v in pairs(script.Parent.ShopFrame.Boxes:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()			
			---Clean
			for _,y in pairs(script.Parent.ShopFrame.BoxContaining.Frame:GetChildren()) do
				if y:IsA("ImageLabel") then
					y:Destroy()
				end
			end
			
			--Add
			local Weaponfolder = game.ReplicatedStorage.Weapons:FindFirstChild(v.Parent.Weapon.Value)
			print(Weaponfolder.Name)
			print(v.Name)
			local Boxfolder = Weaponfolder:FindFirstChild(v.Name)
			local Weapons = Boxfolder:GetChildren()
			if #Weapons > 0 then
				for _,y in pairs(Weapons) do
					local ImgFrame = Instance.new("ImageLabel")
					ImgFrame.Parent = script.Parent.ShopFrame.BoxContaining.Frame
					ImgFrame.Image = y.TextureId
				end
			end
			script.Parent.ShopFrame.BoxContaining.TextLabel.Text = (Boxfolder.Name).." box contains:"
			script.Parent.ShopFrame.BoxContaining.Box.Value = Boxfolder
			script.Parent.ShopFrame.BoxContaining.Visible = true
			script.Parent.ShopFrame.Boxes.Visible = false
		end)
	end
end
--!strict


local function startsWith(value: string, substring: string, position: number?): boolean
	if string.len(substring) == 0 then
		return true
	end
	-- Luau FIXME: we have to use a tmp variable, as Luau doesn't understand the logic below narrow position to `number`
	local position_
	if position == nil or position < 1 then
		position_ = 1
	else
		position_ = position
	end

	if position_ > string.len(value) then
		return false
	end
	return value:find(substring, position_, true) == position_
end

return startsWith
--[[
	Sets the text on the touchable button
]]


function BaseSystem:_setButtonText(text)
	local button = self._model:FindFirstChild("ToggleButton")

	if not button then
		return
	end

	local textLabel = button:FindFirstChild("SurfaceGui"):FindFirstChild("Text")

	if not textLabel then
		return
	end

	textLabel.Text = text
end
--Disable script if car is removed from workspace


Car.AncestryChanged:Connect(function()
	if not Car:IsDescendantOf(Workspace) then
		unbindActions()

		LocalVehicleSeating.ExitSeat()
		LocalVehicleSeating.DisconnectFromSeatExitEvent(onExitSeat)
		-- stop seated anim
		--print("car removed from workspace")

		script.Disabled = true
		ProximityPromptService.Enabled = true
	end
end)

local function exitVehicle(action, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin then
		LocalVehicleSeating.ExitSeat()
		-- stop seated anim
	end
end

local function _updateRawInput(_, inputState, inputObj)
	local key = inputObj.KeyCode
	local data = Keymap.getData(key)

	if not data then 
		return
	end

	local axis = data.Axis
	local val = 0

	if axis then
		val = inputObj.Position:Dot(axis)
	else
		val = (inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change) and 1 or 0
	end

	val = val * (data.Sign or 1)

	_rawInput[key] = val

	if data.Pass then
		return Enum.ContextActionResult.Pass
	end
end

local function _calculateInput(action)
	-- Loop through all mappings for this action and calculate a resultant value from the raw input
	local mappings = Keymap[action]
	local val = 0
	local absVal = val

	for _, data in ipairs(mappings) do
		local thisVal = _rawInput[data.KeyCode]
		if math.abs(thisVal) > absVal then
			val = thisVal
			absVal = math.abs(val)
		end
	end

	return val
end

ContextActionService:BindAction(
	EXIT_ACTION_NAME,
	exitVehicle,
	false,
	Keymap.EnterVehicleGamepad,
	Keymap.EnterVehicleKeyboard
)

ContextActionService:BindActionAtPriority(
	RAW_INPUT_ACTION_NAME,
	_updateRawInput,
	false,
	Enum.ContextActionPriority.High.Value,
	unpack(Keymap.allKeys()))
--[[
	
	Calculates a ratio for interface scaling based on resolution (screen size). Used for scaling down, not up.
	
	Functions.ResolutionScale()
	
--]]




return function()
	--- Return cache
	if tick() - lastCalcTick <= 0.05 then
		return lastCalc
	end
	
	--- calc
	local resolution = camera.ViewportSize
	local resolutionScale = resolution.Magnitude
	local scale = math.clamp(resolutionScale / 1800, 0.33, 1)
	
	--- Cache
	lastCalc = scale
	lastCalcTick = tick()
	
	--
	return scale
end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						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
		handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume)
	end
end
-- this script is optional and not required to have, delete it or keep it



local player = {}
local input = {}
local animation = {}

local players = game:GetService("Players")
local runservice = game:GetService("RunService")
local userinput = game:GetService("UserInputService")

do -- player
	local PLAYER = players.LocalPlayer
	
	player = setmetatable({}, {__index = function(k)
		return rawget(player, k) or PLAYER:FindFirstChild(tostring(k))
	end})
	
	local function onCharacter(character)
		wait()
		player.character = character
		player.mouse = PLAYER:GetMouse()
		player.backpack = PLAYER:WaitForChild("Backpack")
		player.humanoid = player.character:WaitForChild("Humanoid")		
		player.torso = player.character:WaitForChild("Torso")
		player.alive = true
		
		repeat wait() until player.humanoid.Parent == player.character and player.character:IsDescendantOf(game)
		animation.crouch = player.humanoid:LoadAnimation(script:WaitForChild("crouch"))
		input.stance = "stand"
		local onDied onDied = player.humanoid.Died:connect(function()
			player.alive = false
			onDied:disconnect()
			if animation.crouch then
				animation.crouch:Stop(.2)
			end
		end)
	end
	if PLAYER.Character then
		onCharacter(PLAYER.Character)
	end
	PLAYER.CharacterAdded:connect(onCharacter)
end

do -- input
	input.stance = "stand"
	local sprinting = false
	local default_right = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
	local default_left = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
	runservice.RenderStepped:connect(function()
		if animation.crouch then
			if animation.crouch.IsPlaying then
				animation.crouch:AdjustSpeed(Vector3.new(player.torso.Velocity.x, 0, player.torso.Velocity.z).magnitude/10)
			end
		end
	end)
	userinput.TextBoxFocused:connect(function()
		if sprinting then
			sprinting = false
			player.humanoid.WalkSpeed = 16
		end
	end)
	userinput.InputBegan:connect(function(object, g)
		if not g then
			if object.UserInputType == Enum.UserInputType.Keyboard then
				local key = object.KeyCode
				if key == Enum.KeyCode.C then
					if input.stance == "crouch" then
						player.humanoid.HipHeight = 0
						player.humanoid.WalkSpeed = 16
						animation.crouch:Stop(.2)
						input.stance = "stand"
					else
						input.stance = "crouch"
						player.humanoid.HipHeight = -1
						player.humanoid.WalkSpeed = 16 * 0.4
						animation.crouch:Play(.2)
					end
				elseif key == Enum.KeyCode.LeftShift then
					if not sprinting then
						sprinting = true
						player.humanoid.WalkSpeed = 16 * (input.stance == "crouch" and 0.8 or 1.25)
					end
				end
			end
		end
	end)
	userinput.InputEnded:connect(function(object, g)
		if not g then
			if object.UserInputType == Enum.UserInputType.Keyboard then
				local key = object.KeyCode
				if key == Enum.KeyCode.LeftShift then
					if sprinting then
						sprinting = false
						player.humanoid.WalkSpeed = 16 * (input.stance == "crouch" and 0.4 or 1)
					end
				end
			end
		end
	end)
end