Pinkstack/roblox-luau-corpus-text huggingface dataset:
--------



local Handler = require(script.MainHandler)
local HitboxClass = require(script.HitboxObject)

function RaycastHitbox:Initialize(object, ignoreList)
	assert(object, "You must provide an object instance.")
	
	local newHitbox = Handler:check(object)
	if not newHitbox then
		newHitbox = HitboxClass:new()
		newHitbox:config(object, ignoreList)
		newHitbox:seekAttachments(RaycastHitbox.AttachmentName, RaycastHitbox.WarningMessage)
		newHitbox.debugMode = RaycastHitbox.DebugMode
		Handler:add(newHitbox)
	end
	return newHitbox
end

function RaycastHitbox:Deinitialize(object)
	Handler:remove(object)
end

function RaycastHitbox:GetHitbox(object)
   return Handler:check(object, RaycastHitbox.WarningMessage)
end

return RaycastHitbox
---


	elseif sys.Code.Value == true and folder.KV.Value.Value ~= config.AllCode.Value then
		---
		folder.Display.Value = folder.KV
		folder.CodePrivate.Value = ""
		huh.Parent.Display.SurfaceGui.TextLabel.TextTransparency = 0
		---
err()
		wait(1)
		sys.Code.Value = false
	elseif folder.KV.Value.Value == "" and config.AllCodes.Value == false then
		usercodefalse()
--Mobile Controllability


if UserInputService.TouchEnabled then
	ContextActionService:BindActionToInputTypes('RidableHorse_Dismount', (function()
		Dismount()
	end), true, Enum.KeyCode.LeftControl)
	ContextActionService:SetTitle("RidableHorse_Dismount", "Dismount")
end

ServerControl.Changed:connect(function(Property)
	if Property == "Parent" and not ServerControl.Parent then
		ContextActionService:UnbindAction("RidableHorse_Dismount")
		Debris:AddItem(script, 1)
	end
end)
----------------------------------
------------FUNCTIONS-------------
----------------------------------



function Receive(player, action, ...)
	local args = {...}
	if player == User and action == "play" then
		if not MODEL.IsActive.Value or Piano.On.Value then
			Connector:FireAllClients("play", User, args[1], Settings.SoundSource.Position, Settings.PianoSoundRange, Settings.PianoSounds, args[2], Settings.IsCustom)
			HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 and 1) or args[1],args[3])
		end
	elseif player == User and action == "abort" then
		Deactivate()
		if SeatWeld then
			SeatWeld:remove()
		end
	end
end

function Activate(player)
	Connector:FireClient(player, "activate", Settings.CameraCFrame, Settings.PianoSounds, true)
	User = player
end

function Deactivate()
	if User and User.Parent then
		Connector:FireClient(User, "deactivate")
		User.Character:SetPrimaryPartCFrame(Box.CFrame + Vector3.new(0, 5, 0))
	end
	
	User = nil
end
-- NintendoZERG



function Entered(p)

if p:findFirstChild("leaderstats") == nil then

stats = Instance.new("IntValue")
stats.Parent = p
stats.Name = "leaderstats"

money = Instance.new("IntValue")
money.Value = 0 -- How much money each player starts with.
money.Name = "Money"
money.Parent = stats

ao = Instance.new("IntValue")
ao.Value = 0
ao.Name = "AlreadyOwned"
ao.Parent = p

end
end

game.Players.PlayerAdded:connect(Entered)

p = game.Players:GetChildren()
for i = 1, #p do
Entered(p[i])
end
print("LinkedLeaderboard script version 5.00 loaded")

stands = {}
CTF_mode = false

function handleKillCount(humanoid, player)
	local killer = getKillerOfHumanoidIfStillInGame(humanoid)
	if killer ~= nil then
		local stats = killer:findFirstChild("leaderstats")
		if stats ~= nil then
			local kills = stats:findFirstChild("KOs")
			if killer ~= player then
				kills.Value = kills.Value + 1
				
			else
				kills.Value = kills.Value - 1
				
			end
		end
	end
end

function onPlayerEntered(newPlayer)

	if CTF_mode == true then

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


		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 = Instance.new("IntValue")
		kills.Name = "KOs"
		kills.Value = 0

		kills.Parent = stats
		deaths.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

		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
-- Weighted selection
-- 100 total weight


petModule.rarities = {
	
	["Legendary"] = 5; -- 5% chance

	["Rare"] = 15; -- 15% chance
	
	["Uncommon"] = 30; -- 30% chance
	
	["Common"] = 50; -- 50% chance

}

petModule.chooseRandomPet = function()

	local randomNumber = math.random(1,100)
	
	local counter = 0
	
	for rarity, weight in pairs(petModule.rarities) do
		counter = counter + weight
		if randomNumber <= counter then
			
			local rarityTable = petModule.pets[rarity]
			local chosenPet = rarityTable[math.random(1,#rarityTable)]
			
			return chosenPet
			
		end
	end
	
	
end

return petModule
--
--


local Info = {
	-- These are constant values.  Don't change them unless you know what you're doing.

	-- Services
	Players = Game:GetService 'Players',
	PathfindingService = Game:GetService 'PathfindingService',

	-- Advanced settings
	RecomputePathFrequency = 1, -- The monster will recompute its path this many times per second
	RespawnWaitTime = 5, -- How long to wait before the monster respawns
	JumpCheckFrequency = 1, -- How many times per second it will do a jump check
}
local Data = {
	-- These are variable values used internally by the script.  Advanced users only.

	LastRecomputePath = 0,
	Recomputing = false, -- Reocmputing occurs async, meaning this script will still run while it's happening.  This variable will prevent the script from running two recomputes at once.
	PathCoords = {},
	IsDead = false,
	TimeOfDeath = 0,
	CurrentNode = nil,
	CurrentNodeIndex = 1,
	AutoRecompute = true,
	LastJumpCheck = 0,
	LastAttack = 0,
	
	BaseMonster = Self:Clone(),
	AttackTrack = nil,
}
--- Source: https://web.archive.org/web/20131225070434/http://snippets.luacode.org/snippets/Deep_Comparison_of_Two_Values_3


function CompareTable(t1,t2,ignore_mt)
	local ty1 = type(t1)
	local ty2 = type(t2)
	
	if ty1 ~= ty2 then return false end
	
	--- Non-table types can be directly compared
	if ty1 ~= 'table' and ty2 ~= 'table' then return t1 == t2 end
	
	--- As well as tables which have the metamethod __eq
	local mt = getmetatable(t1)
	
	if not ignore_mt and mt and mt.__eq then return t1 == t2 end
	
	for k1,v1 in pairs(t1) do
		local v2 = t2[k1]
		if v2 == nil or not CompareTable(v1,v2) then return false end
	end
	
	for k2,v2 in pairs(t2) do
		local v1 = t1[k2]
		
		if v1 == nil or not CompareTable(v1,v2) then return false end
	end
	
	return true
end
--[=[
	Returns `true` if the given object is a Timer.
]=]


function Timer.Is(obj: any): boolean
	return type(obj) == "table" and getmetatable(obj) == Timer
end


function Timer:_startTimer()
	local t = self.TimeFunction
	local nextTick = t() + self.Interval
	self._runHandle = self.UpdateSignal:Connect(function()
		local now = t()
		if now >= nextTick then
			nextTick = now + self.Interval
			self.Tick:Fire()
		end
	end)
end


function Timer:_startTimerNoDrift()
	assert(self.Interval > 0, "Interval must be greater than 0 when AllowDrift is set to false")
	local t = self.TimeFunction
	local n = 1
	local start = t()
	local nextTick = start + self.Interval
	self._runHandle = self.UpdateSignal:Connect(function()
		local now = t()
		while now >= nextTick do
			n += 1
			nextTick = start + (self.Interval * n)
			self.Tick:Fire()
		end
	end)
end
--Weld stuff here




car.DriveSeat.ChildAdded:connect(function(child)
	if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
		child.C0=CFrame.new(0,1,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
		child.C0=CFrame.Angles(-1.55,0,0)
	end
end)
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 180		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 5500		--		Use sliders to manipulate values
	Tune.Redline		= 6000		--		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)
--[[
	Welds primaryPart to secondaryPart in place
--]]



local function weldParts(primaryPart: BasePart, secondaryPart: BasePart)
	local weld = Instance.new("WeldConstraint")
	weld.Part0 = primaryPart
	weld.Part1 = secondaryPart
	weld.Parent = secondaryPart

	return weld
end

return weldParts
--[[
	Finds the top-level farm model from any descendant and
	returns the OwnerId attribute value of that farm.
--]]



local ReplicatedStorage = game:GetService("ReplicatedStorage")

local FarmConstants = require(ReplicatedStorage.Source.Farm.FarmConstants)
local Attribute = require(ReplicatedStorage.Source.SharedConstants.Attribute)
local getAttribute = require(ReplicatedStorage.Source.Utility.getAttribute)

function getFarmOwnerIdFromInstance(instance: Instance)
	local farm = instance

	while farm and farm.Parent ~= FarmConstants.FarmContainer do
		farm = farm:FindFirstAncestor("Farm")
	end

	assert(farm, "The given instance does not belong to a farm")

	return getAttribute(farm, Attribute.OwnerId) :: number
end

return getFarmOwnerIdFromInstance
-- LOCAL FUNCTIONS


local function dictLength(dictionary)
	local count = 0
	for _, _ in pairs(dictionary) do
		count += 1
	end
	return count
end

local function fillOccupants(zonesAndOccupantsTable, zone, occupant)
	local occupantsDict = zonesAndOccupantsTable[zone]
	if not occupantsDict then
		occupantsDict = {}
		zonesAndOccupantsTable[zone] = occupantsDict
	end
	occupantsDict[occupant] = (occupant.Character or true)
end

local heartbeatActions = {
	["player"] = function(recommendedDetection)
		return ZoneController._getZonesAndPlayers(activeZones, activeZonesTotalVolume, true, recommendedDetection)
	end,
	["localPlayer"] = function(recommendedDetection)
		local zonesAndOccupants = {}
		local touchingZones = ZoneController.getTouchingZones(localPlayer, true, recommendedDetection)
		for _, zone in pairs(touchingZones) do
			if zone.activeTriggers["localPlayer"] then
				fillOccupants(zonesAndOccupants, zone, localPlayer)
			end
		end
		return zonesAndOccupants
	end,
}
--[[Brakes]]


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

	Tune.FBrakeForce	= 150000		-- Front brake force
	Tune.RBrakeForce	= 100000		-- Rear brake force
	Tune.PBrakeForce	= 500000		-- Handbrake force
	
	Tune.FLgcyBForce	= 150000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 100000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 500000	-- Handbrake force [PGS OFF]
--forced walkspeed


function module.Blockingsped(hum)
	coroutine.wrap(function()
		while true do
			task.wait()
			
			if hum.Parent.Data["IsBlocking"].Value  == true then
				hum.WalkSpeed = 3
				hum.JumpPower = 1
				
			elseif hum.Parent.Data["IsBlocking"].Value == false then
				hum.WalkSpeed = 16
				hum.JumpPower = defJump
				break
			end
		end
	end)()
end
--Rear Suspension


Tune.RSusDamping	= 500		-- Spring Dampening
Tune.RSusStiffness	= 8000		-- Spring Force
Tune.RSusLength		= 2			-- Suspension length (in studs)
Tune.RSusMaxExt		= .3		-- Max Extension Travel (in studs)
Tune.RSusMaxComp	= .1		-- 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
--[[
	Defines ProximityPrompt visibility logic specific to the CanHarvest cta
--]]



local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local WagonTag = require(ReplicatedStorage.Source.SharedConstants.CollectionServiceTag.WagonTag)
local CharacterTag = require(ReplicatedStorage.Source.SharedConstants.CollectionServiceTag.CharacterTag)

local getWagonModelFromOwnerId = require(ReplicatedStorage.Source.Utility.Farm.getWagonModelFromOwnerId)
local localPlayer = Players.LocalPlayer :: Player

local function shouldEnable(promptParent: Instance)
	local wagonMaybe = getWagonModelFromOwnerId(localPlayer.UserId)
	if not wagonMaybe then
		-- Wagon doesn't exist, which only happens during the first FTUE stage.
		-- Harvesting triggers the next stage, so we allow harvesting without the wagon.
		return true
	end
	local wagon = wagonMaybe :: Model

	-- If wagon or Character doesn't exist, HasTag() returns false, so this still works correctly
	local isWagonFull = CollectionService:HasTag(wagon, WagonTag.WagonFull)

	local character = localPlayer.Character
	if not character then
		return false
	end

	local isHoldingPlant = CollectionService:HasTag(character :: Model, CharacterTag.Holding)

	-- Can't carry multiple plants
	if isHoldingPlant then
		return false
	end

	-- Don't want the player to be stuck holding a plant they can't place
	if isWagonFull then
		return false
	end

	return true
end

return shouldEnable
------------------------------------------------------------------------
-- closing of a function
------------------------------------------------------------------------


function luaY:close_func(ls)
  local L = ls.L
  local fs = ls.fs
  local f = fs.f
  self:removevars(ls, 0)
  luaK:ret(fs, 0, 0)  -- final return
  -- luaM_reallocvector deleted for f->code, f->lineinfo, f->k, f->p,
  -- f->locvars, f->upvalues; not required for Lua table arrays
  f.sizecode = fs.pc
  f.sizelineinfo = fs.pc
  f.sizek = fs.nk
  f.sizep = fs.np
  f.sizelocvars = fs.nlocvars
  f.sizeupvalues = f.nups
  --assert(luaG_checkcode(f))  -- currently not implemented
  assert(fs.bl == nil)
  ls.fs = fs.prev
  -- the following is not required for this implementation; kept here
  -- for completeness
  -- L->top -= 2;  /* remove table and prototype from the stack */
  -- last token read was anchored in defunct function; must reanchor it
  if fs then self:anchor_token(ls) end
end
--[[Transmission]]


	Tune.TransModes		= {"Semi"}												--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "Manual"}								
		>First mode is default mode													]]
	
	--Automatic Settings
	Tune.AutoShiftMode	= "RPM"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
	Tune.AutoUpThresh	= -200		-- Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		-- Automatic downshift point (relative to peak RPM, positive = Under-rev)
	Tune.ShiftTime = .25				-- The time delay in which you initiate a shift and the car changes gear
	
	--Gear Ratios
	Tune.FinalDrive		= 3.21		 --	[TRANSMISSION CALCULATIONS FOR NERDS]
	Tune.Ratios			= {			 --		SPEED [SPS]	 = (Wheel diameter(studs) * pi(3.14) * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
		--[[Reverse]]	5.000		,--		WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
		--[[Neutral]]	0			,
		--[[ 1 ]]		3.519      	,
		--[[ 2 ]]		2.320		,
		--[[ 3 ]]		1.700		,
		--[[ 4 ]]		1.400		,
		--[[ 5 ]]		0.907		,
	}
	Tune.FDMult			= 1.3			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
--[[
	For when the Server is in state
]]


local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local SystemManager = require(ServerStorage.Source.Managers.SystemManager)
local RoomManager = require(ServerStorage.Source.Managers.RoomManager)
local Constants = require(ReplicatedStorage.Source.Common.Constants)
local tagMap = require(ServerStorage.Source.tagMap)
local spawnToolsAsync = require(ServerStorage.Source.spawnToolsAsync)
local spawnMeteor = require(ServerStorage.Source.spawnMeteor)
local sendAlert = require(ServerStorage.Source.Common.sendAlert)
local translate = require(ReplicatedStorage.Dependencies.GameUtils.TranslateUtils).translate

local METEOR_FREQUENCY_PER_PLAYER = 45
local SHIELD_DEFLECT_RATE = 40
local connections = {}

local ServerGame = {}
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================


local function GetCameraRotation(root)
	-- Relative rotational velocity:
	dampCam.Goal = -root.CFrame:vectorToObjectSpace(root.RotVelocity) * 0.1
	local relRotVel = dampCam:Update()
	
	-- User view rotation:
	local viewRotation = dampRot:Update()
	viewRotation = CFrame.Angles(0, viewRotation.X, 0) * CFrame.Angles(viewRotation.Y, 0, 0)
	
	return CFrame.Angles(0, 0, 0) * viewRotation * CFrame.Angles(relRotVel.X, relRotVel.Y, relRotVel.Z)
end -- GetCameraRotation

local function GetViewCFrame(view, rotation)
	return view * PIVOT * rotation * OFFSET
end -- GetViewCFrame
--//////// DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU'RE DOING \\\\\\\\\\\\\\\\\\\\\\\\\





local uis = game:GetService("UserInputService")
local runservice = game:GetService("RunService")
local tweenservice = game:GetService("TweenService")
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local camera = workspace.CurrentCamera
repeat runservice.Heartbeat:Wait() until script.Parent:IsA("Model") -- yield until character
local character = player.Character
local rootpart = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local aimoffset = script:WaitForChild("AimOffset") -- a property for other scripts to use to influence the viewmodel offset (such as a gun aim system)
local torso
local roothip
local lowertorso
local oldc0
local leftshoulder
local rightshoulder
local larm
local rarm
local armparts = {}
local rigtype = nil

local isrunning = false
local armsvisible = true -- whether the arms are visible in first person
local armtransparency = firstperson_arm_transparency
local isfirstperson = false
local sway = Vector3.new(0,0,0)
local walksway = CFrame.new(0,0,0)
local strafesway = CFrame.Angles(0,0,0)
local jumpsway = CFrame.new(0,0,0)
local jumpswaygoal = Instance.new("CFrameValue")
-- Create component


local Component = Cheer.CreateComponent('Tooltip', View);

local Connections = {};

function Component.Start(Text)

	-- Hide the view
	View.Visible = false;

	-- Set the tooltip text
	View.Text = Text;

	-- Show the tooltip on hover
	Connections.ShowOnEnter = Support.AddGuiInputListener(View.Parent, 'Began', 'MouseMovement', true, Component.Show);
	Connections.HideOnLeave = Support.AddGuiInputListener(View.Parent, 'Ended', 'MouseMovement', true, Component.Hide);

	-- Clear connections when the component is removed
	Cheer.Bind(Component.OnRemove, ClearConnections);

	-- Return component for chaining
	return Component;

end;

function Component.Show()
	View.Size = UDim2.new(0, View.TextBounds.X + 10, 0, View.TextBounds.Y + 10);
	View.Position = UDim2.new(0.5, -View.AbsoluteSize.X / 2, 1, 3);
	View.Visible = true;
end;

function Component.Hide()
	View.Visible = false;
end;

function ClearConnections()
	-- Clears out temporary connections

	for ConnectionKey, Connection in pairs(Connections) do
		Connection:Disconnect();
		Connections[ConnectionKey] = nil;
	end;

end;

return Component;
-- Notify all clients that a laser has been fired so they can display the laser


local function playerFiredLaser(playerFired, endPosition)
	local toolHandle = getPlayerToolHandle(playerFired)
	if toolHandle then
		eventsFolder.LaserFired:FireAllClients(playerFired, toolHandle, endPosition)
	end
end

function damageCharacter(playerFired, characterToDamage, hitPosition)
	local humanoid = characterToDamage:FindFirstChild("Humanoid")
	local validShot = isHitValid(playerFired, characterToDamage, hitPosition)
	if humanoid and validShot then
		-- Remove health from character
		humanoid.Health -= LASER_DAMAGE
	end
end
-- Permissions



function CanEditObject(object)
	local player = Players.LocalPlayer
	local character = player.Character
	return Permissions.CanEdit
end

function CanEditProperty(object,propertyData)
	local tags = propertyData["tags"]
	for _,name in pairs(tags) do
		if name == "readonly" then
			return false
		end
	end
	return CanEditObject(object)
end
--Turbo Settings


Tune.Aspiration		= "Single"												--[[
	[Aspiration]
		"Natural"		: N/A, Naturally aspirated engine
		"Single"		: Single turbocharger
		"Double"		: Twin turbocharger											]]

Tune.Boost			= 8		--Max PSI per turbo (If you have two turbos and this is 15, the PSI will be 30)
Tune.TurboSize		= 25		--Turbo size; the bigger it is, the more lag it has.
Tune.CompressRatio	= 9			--The compression ratio (look it up)
--wait(math.random(0,5)/10)


while true do
	wait(0.2)
	local target = findNearestTorso(humRoot.Position)
	if target ~= nil then
		script.Parent.Humanoid:MoveTo(target.Position + Vector3.new(math.random(-3,3),0,math.random(-3,3)), target)
	end
	if math.random(1,5) == 1 then
		script.Parent.Humanoid.Jump = true
	end
end
--[[
	Used to catch any errors that may have occurred in the promise.
]]


function Promise.prototype:catch(failureCallback)
	assert(
		failureCallback == nil or type(failureCallback) == "function" or failureCallback.__call ~= nil,
		string.format(ERROR_NON_FUNCTION, "Promise:catch")
	)
	return self:_andThen(debug.traceback(nil, 2), nil, failureCallback)
end
-- Shifter


if INVERTED == false then INVERTED = 1 else INVERTED = -1 end
Values.Gear.Changed:connect(function()
	local Gear = Values.Gear.Value
	local Shift = "Down"
	if Gear > Val then Shift = "Up" end
	Val = Gear
	
	script.Shift:Play()
	if FE then
		handler:FireServer("Shifter",Shift,MOT,ANGLE,INVERTED,SHIFT_TIME)
	else
		if Shift == "Up" then
			MOT.DesiredAngle = math.rad(ANGLE)*INVERTED
			wait(SHIFT_TIME)
			MOT.DesiredAngle = 0
		else
			MOT.DesiredAngle = -math.rad(ANGLE)*INVERTED
			wait(SHIFT_TIME)
			MOT.DesiredAngle = 0
		end
	end
end)
--[=[
	Removes a postfix from a string if it exists
	@param str string
	@param postfix string
	@return string
]=]


function String.removePostfix(str: string, postfix: string): string
	if str:sub(-#postfix) == postfix then
		return str:sub(1, -#(postfix) - 1)
	else
		return str
	end
end
--Interpret input


local function getInputValues()
	if UserInputService:GetLastInputType() ~= Enum.UserInputType.Touch then
		---Let the control module handle all none-touch controls
		script.Steering.Value = SteerLeftValue - SteerRightValue
		script.Throttle.Value = ThrottleValue - BrakeValue
		script.HandBrake.Value = HandBrakeValue
	else --The vehicle gui handles all the touch controls
		script.Throttle.Value = VehicleGui.throttleInput
		script.Steering.Value = VehicleGui.steeringInput
		script.HandBrake.Value = VehicleGui.handBrakeInput
	end
end