Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Customized explosive effect that doesn't affect teammates and only breaks joints on dead parts


local function OnExplosionHit(hitPart, hitDistance, blastCenter)
	if hitPart and hitDistance then
		local character, humanoid = FindCharacterAncestor(hitPart.Parent)
		if humanoid and humanoid.Health > 0 then -- Humanoids are tagged and damaged
			if hitPart.Name == 'Torso' then
				--ApplyTags(humanoid)
				DamageTag(character,BLAST_DAMAGE)
				--humanoid:TakeDamage(BLAST_DAMAGE)
			end
		end
	end
end

local function OnTouched(otherPart,RayPos)
	if Rocket and otherPart then
		-- Fly through anything in the ignore list
		if IGNORE_LIST[string.lower(otherPart.Name)] or (otherPart.Parent == Tank) then
			return
		end

		local myPlayer = CreatorTag.Value
		if myPlayer then
			-- Fly through the creator
			if myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
				return
			end

			 -- Fly through friendlies
			if not myPlayer.Neutral then
				local character = FindCharacterAncestor(otherPart.Parent)
				local player = PlayersService:GetPlayerFromCharacter(character)
				if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
					return
				end
			end
		end

		-- Fly through terrain water
		--[[if otherPart == Workspace.Terrain then
			--NOTE: If the rocket is large, then the simplifications made here will cause it to fly through terrain in some cases
			local frontOfRocket = Rocket.Position + (Rocket.CFrame.lookVector * (Rocket.Size.Z / 2))
			local cellLocation = Workspace.Terrain:WorldToCellPreferSolid(frontOfRocket)
			local cellMaterial = Workspace.Terrain:GetCell(cellLocation.X, cellLocation.Y, cellLocation.Z)
			if cellMaterial == Enum.CellMaterial.Water or cellMaterial == Enum.CellMaterial.Empty then
				return
			end
		end]]
		
		Rocket.Transparency = 1
		Rocket.CFrame = CFrame.new(RayPos.X,RayPos.Y,RayPos.Z)

		-- Create the explosion
		local explosion = Instance.new('Explosion')
		explosion.BlastPressure = 500000 -- Completely safe explosion
		explosion.BlastRadius = BLAST_RADIUS
		explosion.DestroyJointRadiusPercent = 0
		explosion.ExplosionType = Enum.ExplosionType.NoCraters
		explosion.Position = Rocket.Position
		explosion.Parent = game.Players.LocalPlayer.Character.Torso

		-- Connect custom logic for the explosion
		explosion.Hit:connect(function(hitPart, hitDistance) OnExplosionHit(hitPart, hitDistance, explosion.Position) end)
		
		ypcall(function()
			for i = 1, 3 do
				ExplodeClone = Explode:clone()
				ExplodeClone.Position = Rocket.Position
				ExplodeClone.Mesh.Scale = Vector3.new(5,5,5)*5
				ExplodeClone.CFrame = ExplodeClone.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-10000,10000)/100,math.random(-10000,10000)/100,math.random(-10000,10000)/100)
				ExplodeClone.Parent = game.Players.LocalPlayer.Character.Torso
				NewScript = Rocket.SmokeScript:clone()
				NewScript.Disabled = false
				NewScript.Parent = ExplodeClone
			end
		end)

		-- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
		script.Parent = explosion
		CreatorTag.Parent = script
		Rocket:Destroy()
	end
end
-- local script 


local player = game.Players.LocalPlayer
local ScreenGui = script.Parent.Frame

local function checkKnightValue()
	local knightValue = player:FindFirstChild("Knight")
	if knightValue and knightValue.Value then
		ScreenGui.Visible = true
	else
		ScreenGui.Visible = false
	end
end

player.ChildAdded:Connect(checkKnightValue)
player.ChildRemoved:Connect(checkKnightValue)
checkKnightValue()
--[[
	Extended typeof, designed for identifying custom objects.
	If given a table with a `type` string, returns that.
	Otherwise, returns `typeof()` the argument.
]]



local function xtypeof(x: any)
	local typeString = typeof(x)

	if typeString == "table" and typeof(x.type) == "string" then
		return x.type
	else
		return typeString
	end
end

return xtypeof
--- Registers a command definition and its server equivalent.
-- Handles replicating the definition to the client.


function Registry:RegisterCommand (commandScript, commandServerScript, filter)
	local commandObject = require(commandScript)

	if commandServerScript then
		commandObject.Run = require(commandServerScript)
	end

	if filter and not filter(commandObject) then
		return
	end

	self:RegisterCommandObject(commandObject)

	commandScript.Parent = self.Cmdr.ReplicatedRoot.Commands
end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]




local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 45				,
		spInc			= 5				, -- Increment between labelled notches
	},
	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 370				,
		spInc			= 40				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 400				,
		spInc			= 40				, -- Increment between labelled notches
	}
}
-- spawn a random ore


local oreName = oreBank[math.random(1,#oreBank)]
local newOre = game.ServerStorage.Items:FindFirstChild(oreName):Clone()
newOre.CFrame = root.CFrame*CFrame.new(0,1,0)
newOre.Parent = workspace--DevVince was here, hehe.
game.Debris:AddItem(newOre, 60*4)--Clean up old ores.
end
end)
AttitudeCoroutine()


while true do
if mode == "charLock" then
targetLocation = (charRoot.CFrame*CFrame.new(3,-2.6,1)).p
targetLook = charRoot.CFrame*CFrame.new(charRoot.CFrame.lookVector*1000)
end
bg.CFrame = targetLook
bp.Position = targetLocation
wait()
end
--[[**
	ensures value is a given literal value

	@param literal The literal to use

	@returns A function that will return true iff the condition is passed
**--]]


function t.literal(...)
	local size = select("#", ...)
	if size == 1 then
		local literal = ...
		return function(value)
			if value ~= literal then
				return false
			end

			return true
		end
	else
		local literals = {}
		for i = 1, size do
			local value = select(i, ...)
			literals[i] = t.literal(value)
		end

		return t.union(table.unpack(literals, 1, size))
	end
end
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,FastReload = true					--- Automatically operates the bolt on reload if needed
	,SlideLock = false
	,MoveBolt = false
	,BoltLock = false
	,CanBreachDoor = false
	,CanBreak = true					--- Weapon can jam?
	,JamChance = 1000					--- This old piece of brick doesn't work fine >;c
	,IncludeChamberedBullet = true		--- Include the chambered bullet on next reload
	,Chambered = false					--- Start with the gun chambered?
	,LauncherReady = false				--- Start with the GL ready?
	,CanCheckMag = true					--- You can check the magazine
	,ArcadeMode = false					--- You can see the bullets left in magazine
	,RainbowMode = false				--- Operation: Party Time xD
	,ModoTreino = false					--- Surrender enemies instead of killing them
	,GunSize = 1
	,GunFOVReduction = 5

	,BoltExtend = Vector3.new(0, 0, 0.375)
	,SlideExtend = Vector3.new(0, 0, 0.3)
---------------------------
--[[
	--Main anchor point is the DriveSeat <car.DriveSeat>	
	
	Usage:
		MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld"  **Applies to Motor welds only
		ModelWeld(Model,MainPart)
	Example:
		MakeWeld(car.DriveSeat,misc.PassengerSeat)
		MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
		ModelWeld(car.DriveSeat,misc.Door)
]]
--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(-1,-.4,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
	end
end)
--[=[
	Loads the data at the `name`.
	@param name string
	@param defaultValue T?
	@return Promise<T>
]=]


function DataStoreStage:Load(name, defaultValue)
	if not self._loadParent then
		error("[DataStoreStage.Load] - Failed to load, no loadParent!")
	end
	if not self._loadName then
		error("[DataStoreStage.Load] - Failed to load, no loadName!")
	end

	if self._dataToSave and self._dataToSave[name] ~= nil then
		if self._dataToSave[name] == DataStoreDeleteToken then
			return Promise.resolved(defaultValue)
		else
			return Promise.resolved(self._dataToSave[name])
		end
	end

	return self._loadParent:Load(self._loadName, {}):Then(function(data)
		return self:_afterLoadGetAndApplyStagedData(name, data, defaultValue)
	end)
end
--[=[
	@tag Component Class
	@return Promise<ComponentInstance>

	Resolves a promise once the component instance is present on a given
	Roblox instance.

	An optional `timeout` can be provided to reject the promise if it
	takes more than `timeout` seconds to resolve. If no timeout is
	supplied, `timeout` defaults to 60 seconds.

	```lua
	local MyComponent = require(somewhere.MyComponent)

	MyComponent:WaitForInstance(workspace.SomeInstance):andThen(function(myComponentInstance)
		-- Do something with the component class
	end)
	```
]=]


function Component:WaitForInstance(instance: Instance, timeout: number?)
	local componentInstance = self:FromInstance(instance)
	if componentInstance then
		return Promise.resolve(componentInstance)
	end
	return Promise.fromEvent(self.Started, function(c)
		local match = c.Instance == instance
		if match then
			componentInstance = c
		end
		return match
	end)
		:andThen(function()
			return componentInstance
		end)
		:timeout(if type(timeout) == "number" then timeout else DEFAULT_TIMEOUT)
end
-- ROBLOX FIXME: Can we define ClientChatModules statically in the project config


pcall(function() ChatLocalization = require((game:GetService("Chat") :: any).ClientChatModules.ChatLocalization :: any) end)
if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end end

local numChildrenRemaining = 10 -- #waitChildren returns 0 because it's a dictionary
local waitChildren = {
	OnNewMessage = "RemoteEvent",
	OnMessageDoneFiltering = "RemoteEvent",
	OnNewSystemMessage = "RemoteEvent",
	OnChannelJoined = "RemoteEvent",
	OnChannelLeft = "RemoteEvent",
	OnMuted = "RemoteEvent",
	OnUnmuted = "RemoteEvent",
	OnMainChannelSet = "RemoteEvent",

	SayMessageRequest = "RemoteEvent",
	GetInitDataRequest = "RemoteFunction",
}
-- Detect when prompt is triggered


local function onPromptTriggered(player)
	if player.Character and player.Character:FindFirstChild("Humanoid") ~= nil and player.Character.Humanoid.Health > 0 then

		for _,Child in pairs(player.Character:GetChildren()) do 
			if Child:IsA("Tool") and require(Child.ACS_Settings).Type == 'Gun' and Stored.Value > 0 then 
				if Universal then
					Evt.Refil:FireClient(player, Child, Infinite, Stored)
					script.Parent.Parent.RefilSound:Play()
				else
					if require(Child.ACS_Settings).BulletType == BulletType then
						Evt.Refil:FireClient(player, Child, Infinite, Stored)
						script.Parent.Parent.RefilSound:Play()
					end
				end
			end
		end
	end
end
--vehicle.Nose.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
--vehicle.Bumper_Front.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
--vehicle.Bumper_Back.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
--vehicle.Tailgate.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
--vehicle.ExhaustPipe.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)



frontForceField.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
backForceField.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)

vehicle.Wheel_BackLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 1, 0)) end)
vehicle.Wheel_FrontLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 1, 0)) end)
vehicle.Wheel_BackRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, -1, 0)) end)
vehicle.Wheel_FrontRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, -1, 0)) end)

local vehicleDamaged = false
function checkIfVehicleIsDamaged()
	if (not frontForceField.Parent or not backForceField.Parent) and not vehicleDamaged and allowDamage then
		vehicleDamaged = true
		script.IsDamaged.Value = true
		vehicle.VehicleScript.Disabled = true
		vehicleSmoke.Enabled = true
		vehicle.VehicleSeat.MaxSpeed = 0
		vehicle.ExhaustPipe.Smoke.Enabled = false
		-- Break Joints
		vehicle.Wheel_BackLeft:BreakJoints()
		vehicle.Wheel_FrontLeft:BreakJoints()
		vehicle.Wheel_BackRight:BreakJoints()
		vehicle.Wheel_FrontRight:BreakJoints()
		hood:BreakJoints()
	end
end

vehicle.ChildRemoved:connect(checkIfVehicleIsDamaged)
--[=[
	Similiar to Fusion's ComputedPairs, where the changes are cached, and the lifetime limited.
	@param source Observable<T> | any
	@param compute (key: any, value: any, innerMaid: Maid) -> Instance | Observable<Instance>
	@return Observable<Brio<Instance>>
]=]


function Blend.ComputedPairs(source, compute)
	local sourceObservable = Blend.toPropertyObservable(source) or Rx.of(source)

	return Observable.new(function(sub)
		local cache = {}
		local topMaid = Maid.new()

		local maidForKeys = Maid.new()
		topMaid:GiveTask(maidForKeys)

		topMaid:GiveTask(sourceObservable:Subscribe(function(newValue)
			-- It's gotta be a table
			assert(type(newValue) == "table", "Bad value emitted from source")

			local excluded = {}
			for key, _ in pairs(cache) do
				excluded[key] = true
			end

			for key, value in pairs(newValue) do
				excluded[key] = nil

				if cache[key] ~= value then
					local innerMaid = Maid.new()
					local result = compute(key, value, innerMaid)

					local brio = Brio.new(result)
					innerMaid:GiveTask(brio)

					sub:Fire(brio)

					maidForKeys[key] = innerMaid
					cache[key] = value
				end
			end

			for key, _ in pairs(excluded) do
				maidForKeys[key] = nil
				cache[key] = nil
			end
		end), sub:GetFailComplete())

		return topMaid
	end)
end
--[[[Default Controls]]


	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 10		,	-- Mouse steering deadzone (0 - 100%)
		
		ControlLDZone			= 5			,	-- Controller steering L-deadzone (0 - 100%)
		ControlRDZone			= 5			,	-- Controller steering R-deadzone (0 - 100%)
	}
	
	--Control Mapping
	Tune.Controls = {
		
	--Keyboard Controls
		--Mode Toggles
		ToggleTCS				= Enum.KeyCode.T					,
		ToggleABS				= Enum.KeyCode.Y					,
		ToggleTransMode			= Enum.KeyCode.M					,
		ToggleMouseDrive		= Enum.KeyCode.R					,
		
		--Primary Controls
		Throttle				= Enum.KeyCode.W					,
		Brake					= Enum.KeyCode.S					,
		SteerLeft				= Enum.KeyCode.A					,
		SteerRight				= Enum.KeyCode.D   				    ,
		
		--Secondary Controls
		Throttle2				= Enum.KeyCode.B 					,
		Brake2					= Enum.KeyCode.N					,
		SteerLeft2				= Enum.KeyCode.M 	 				,
		SteerRight2				= Enum.KeyCode.V					,
		
		--Manual Transmission
		ShiftUp					= Enum.KeyCode.E					,
		ShiftDown				= Enum.KeyCode.Q					,
		Clutch					= Enum.KeyCode.LeftShift    			,
		
		--Handbrake
		PBrake					= Enum.KeyCode.X			,
		
	--Mouse Controls
		MouseThrottle			= Enum.UserInputType.MouseButton1	,
		MouseBrake				= Enum.UserInputType.MouseButton2	,
		MouseClutch				= Enum.KeyCode.W					,
		MouseShiftUp			= Enum.KeyCode.E					,
		MouseShiftDown			= Enum.KeyCode.Q					,
		MousePBrake				= Enum.KeyCode.LeftShift			,
		
	--Controller Mapping
		ContlrThrottle			= Enum.KeyCode.ButtonR2				,
		ContlrBrake				= Enum.KeyCode.ButtonL2				,
		ContlrSteer				= Enum.KeyCode.Thumbstick1			,
		ContlrShiftUp			= Enum.KeyCode.ButtonY				,
		ContlrShiftDown			= Enum.KeyCode.ButtonX				,
		ContlrClutch			= Enum.KeyCode.ButtonR1				,
		ContlrPBrake			= Enum.KeyCode.ButtonL1				,
		ContlrToggleTMode		= Enum.KeyCode.DPadUp				,
		ContlrToggleTCS			= Enum.KeyCode.DPadDown				,
		ContlrToggleABS			= Enum.KeyCode.DPadRight			,
	}
--[=[
	Converts this arbitrary value into an event handler, which can be subscribed to

	@param value any
	@return function?
]=]


function Blend.toEventHandler(value)
	if type(value) == "function" then
		return value
	elseif typeof(value) == "Instance" then
		-- IntValue, ObjectValue, et cetera
		if ValueBaseUtils.isValueBase(value) then
			return function(result)
				value.Value = result
			end
		end
	elseif type(value) == "table" then
		if Signal.isSignal(value) then
			return function(...)
				value:Fire(...)
			end
		elseif value.ClassName == "ValueObject" then
			return function(result)
				value.Value = result
			end
		end
	end

	return nil
end
--[=[
	@within TableUtil
	@function Shuffle
	@param tbl table
	@param rngOverride Random?
	@return table

	Shuffles the table.

	```lua
	local t = {1, 2, 3, 4, 5, 6, 7, 8, 9}
	local shuffled = TableUtil.Shuffle(t)
	print(shuffled) --> e.g. {9, 4, 6, 7, 3, 1, 5, 8, 2}
	```

	:::note Arrays only
	This function works on arrays, but not dictionaries.
]=]


local function Shuffle<T>(tbl: { T }, rngOverride: Random?): { T }
	assert(type(tbl) == "table", "First argument must be a table")
	local shuffled = table.clone(tbl)
	local random = if typeof(rngOverride) == "Random" then rngOverride else rng
	for i = #tbl, 2, -1 do
		local j = random:NextInteger(1, i)
		shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
	end
	return shuffled
end
-- Requires - Module Functions


ClientSceneFramework.AnchorClientForSceneTransitionModule = require(script.AnchorClientForSceneTransitionModule)
ClientSceneFramework.UnloadSceneClientRemoteEventModule = require(script.UnloadSceneClientRemoteEventModule)
ClientSceneFramework.LoadSceneRemoteEventModule = require(script.LoadSceneRemoteEventModule)
ClientSceneFramework.GetCurrentSceneEnvironmentModule = require(script.GetCurrentSceneEnvironmentModule)
ClientSceneFramework.InitModule = require(script.InitModule)

local Orchestra = script.Parent
--Get the data store with key "Leaderboard"


wait(10)
while true do
	for i,plr in pairs(game.Players:GetChildren()) do--Loop through players
		if plr.UserId>0 then--Prevent errors
			local ps = game:GetService("PointsService")--PointsService
			local w = ps:GetGamePointBalance(plr.UserId)--Get point balance
			if w then
				pcall(function()
				--Wrap in a pcall so if Roblox is down, it won't error and break.
					dataStore:UpdateAsync(plr.UserId,function(oldVal)
				        --Set new value
						return tonumber(w)
					end)
				end)
			end
		end
	end    
	local smallestFirst = false--false = 2 before 1, true = 1 before 2
    local numberToShow = 100--Any number between 1-100, how many will be shown
    local minValue = 1--Any numbers lower than this will be excluded
    local maxValue = 10e30--(10^30), any numbers higher than this will be excluded
    local pages = dataStore:GetSortedAsync(smallestFirst, numberToShow, minValue, maxValue)
    --Get data
    local top = pages:GetCurrentPage()--Get the first page
	local data = {}--Store new data
	for a,b in ipairs(top) do--Loop through data
		local userid = b.key--User id
		local points = b.value--Points
		local username = "[Failed To Load]"--If it fails, we let them know
		local s,e = pcall(function()
		 username = game.Players:GetNameFromUserIdAsync(userid)--Get username
		end)
		if not s then--Something went wrong
		   warn("Error getting name for "..userid..". Error: "..e)
		end
		local image = game.Players:GetUserThumbnailAsync(userid, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
		--Make a image of them
		table.insert(data,{username,points,image})--Put new data in new table
	end
	ui.Parent = script
	sf:ClearAllChildren()--Remove old frames
	ui.Parent = sf
	for number,d in pairs(data) do--Loop through our new data
		local name = d[1]
		local val = d[2]
		local image = d[3]
		local color = Color3.new(1,1,1)--Default color
		if number == 1 then
			color = Color3.new(1,1,0)--1st place color
		elseif number == 2 then
			color = Color3.new(0.9,0.9,0.9)--2nd place color
		elseif number == 3 then
			color = Color3.fromRGB(166, 112, 0)--3rd place color
		end
		local new = sample:Clone()--Make a clone of the sample frame
		new.Name = name--Set name for better recognition and debugging
        new.LayoutOrder = number--UIListLayout uses this to sort in the correct order
		new.Image.Image = image--Set the image
		new.Image.Place.Text = number--Set the place
		new.Image.Place.TextColor3 = color--Set the place color (Gold = 1st)
		new.PName.Text = name--Set the username
		new.Value.Text = val--Set the amount of points
		new.Value.TextColor3 = color--Set the place color (Gold = 1st)
		new.PName.TextColor3 = color--Set the place color (Gold = 1st)
		new.Parent = sf--Parent to scrolling frame
	end
	wait()
	sf.CanvasSize = UDim2.new(0,0,0,ui.AbsoluteContentSize.Y)
	--Give enough room for the frames to sit in
	wait(60)
end
-------------------------


 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
        if key == "a" then
            	a = true
        elseif key == "d" then
                d = true
        elseif key == "w" then
                w = true
                rwd.Throttle = 1
				rwd.Torque = tq
				lwd.Throttle = 1
				lwd.Torque = ftq
				rrwd.Throttle = 1
				rrwd.Torque = ftq
				rwd.MaxSpeed = 136
				lwd.MaxSpeed = 136
				rrwd.MaxSpeed = 136
                carSeat.Throttle = 1
                carSeat.Torque = 0
                elseif key == "s" then
                s = true    
                carSeat.Throttle = 0
                carSeat.Torque = 0
				rwd.Throttle = -1
				rwd.Torque = brk
				lwd.Throttle = -1
				lwd.Torque = brk
				rrwd.Throttle = -1
				rrwd.Torque = brk
				rwd.MaxSpeed = 25
				lwd.MaxSpeed = 25
				rrwd.MaxSpeed = 25
                end
end)
 
mouse.KeyUp:connect(function (key)
    key = string.lower(key)
        if key == "a" then
                print("a up")
                if d == false then
                m.DesiredAngle = 0
                        n.DesiredAngle = m.DesiredAngle
                end
        elseif key == "d" then
                print("d up")
                if a == false then
                m.DesiredAngle = 0
                        n.DesiredAngle = m.DesiredAngle
end
        end
        a = false
        d = false
end)
 
mouse.KeyUp:connect(function (key)
    key = string.lower(key)
if key == "w" or key == "s" then
        rwd.Throttle = 0
        rwd.Torque = 0
	    lwd.Throttle = 0
		lwd.Torque = 0
		rrwd.Throttle = 0
		rrwd.Torque = 0

       carSeat.Throttle = 0
carSeat.Torque = cst
        end
end)   
               
 
 
limitButton.MouseButton1Click:connect(function()
--Update RPM


local function RPM()
	--Neutral Gear
	if _CGear==0 then _ClutchOn = false end
	throt = script.Parent.Values.Throttle.Value
	if game.Players.LocalPlayer.PlayerGui["A-Chassis Interface"].AC6_Stock_Gauges.SelfDrive:GetAttribute("Enabled") == false then
		throt = _GThrot
	end

	--Car Is Off
	local revMin = _Tune.IdleRPM
	if not _IsOn then 
		revMin = 0 
		_CGear = 0
		_ClutchOn = false
		throt = _Tune.IdleThrottle/100
	end

	--Determine RPM
	local maxSpin=0
	for _,v in pairs(Drive) do
		if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
	end
	if _ClutchOn then
		local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
		local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
		_RPM = _RPM*clutchP  +  aRPM*(1-clutchP)
	else
		if throt-(_Tune.IdleThrottle/100)>0 then
			if _RPM>_Tune.Redline then
				_RPM = _RPM-_Tune.RevBounce*2
			else
				_RPM = math.min(_RPM+_Tune.RevAccel*throt,_Tune.Redline+100)
			end
		else
			_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
		end
	end

	--Rev Limiter
	_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
	if _RPM>_Tune.Redline then 
		if _CGear<#_Tune.Ratios-2 then
			_RPM = _RPM-_Tune.RevBounce
		else
			_RPM = _RPM-_Tune.RevBounce*.5
		end
	end
end