Prompt: -- Decompiled with the Synapse X Luau decompiler.

Response:
local v1 = {};
v1.__index = v1;
local l__Players__2 = game:GetService("Players");
local l__RunService__3 = game:GetService("RunService");
local l__UserInputService__4 = game:GetService("UserInputService");
local l__GuiService__5 = game:GetService("GuiService");
local l__Workspace__6 = game:GetService("Workspace");
local l__UserGameSettings__7 = UserSettings():GetService("UserGameSettings");
local l__VRService__8 = game:GetService("VRService");
local v9 = require(script:WaitForChild("Keyboard"));
local v10 = require(script:WaitForChild("Gamepad"));
local v11 = require(script:WaitForChild("DynamicThumbstick"));
local v12, v13 = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserHideControlsWhenMenuOpen");
end);
local v14 = require(script:WaitForChild("TouchThumbstick"));
local v15 = require(script:WaitForChild("ClickToMoveController"));
local u1 = v12 or v13;
local u2 = require(script:WaitForChild("VehicleController"));
local l__Value__3 = Enum.ContextActionPriority.Default.Value;
function v1.new()
	local v16 = setmetatable({}, v1);
	v16.controllers = {};
	v16.activeControlModule = nil;
	v16.activeController = nil;
	v16.touchJumpController = nil;
	v16.moveFunction = l__Players__2.LocalPlayer.Move;
	v16.humanoid = nil;
	v16.lastInputType = Enum.UserInputType.None;
	v16.controlsEnabled = true;
	v16.humanoidSeatedConn = nil;
	v16.vehicleController = nil;
	v16.touchControlFrame = nil;
	if u1 then
		l__GuiService__5.MenuOpened:Connect(function()
			if v16.touchControlFrame and v16.touchControlFrame.Visible then
				v16.touchControlFrame.Visible = false;
			end;
		end);
		l__GuiService__5.MenuClosed:Connect(function()
			if v16.touchControlFrame then
				v16.touchControlFrame.Visible = true;
			end;
		end);
	end;
	v16.vehicleController = u2.new(l__Value__3);
	l__Players__2.LocalPlayer.CharacterAdded:Connect(function(p1)
		v16:OnCharacterAdded(p1);
	end);
	l__Players__2.LocalPlayer.CharacterRemoving:Connect(function(p2)
		v16:OnCharacterRemoving(p2);
	end);
	if l__Players__2.LocalPlayer.Character then
		v16:OnCharacterAdded(l__Players__2.LocalPlayer.Character);
	end;
	l__RunService__3:BindToRenderStep("ControlScriptRenderstep", Enum.RenderPriority.Input.Value, function(p3)
		v16:OnRenderStepped(p3);
	end);
	l__UserInputService__4.LastInputTypeChanged:Connect(function(p4)
		v16:OnLastInputTypeChanged(p4);
	end);
	l__UserGameSettings__7:GetPropertyChangedSignal("TouchMovementMode"):Connect(function()
		v16:OnTouchMovementModeChange();
	end);
	l__Players__2.LocalPlayer:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function()
		v16:OnTouchMovementModeChange();
	end);
	l__UserGameSettings__7:GetPropertyChangedSignal("ComputerMovementMode"):Connect(function()
		v16:OnComputerMovementModeChange();
	end);
	l__Players__2.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
		v16:OnComputerMovementModeChange();
	end);
	v16.playerGui = nil;
	v16.touchGui = nil;
	v16.playerGuiAddedConn = nil;
	l__GuiService__5:GetPropertyChangedSignal("TouchControlsEnabled"):Connect(function()
		v16:UpdateTouchGuiVisibility();
		v16:UpdateActiveControlModuleEnabled();
	end);
	if not l__UserInputService__4.TouchEnabled then
		v16:OnLastInputTypeChanged(l__UserInputService__4:GetLastInputType());
		return v16;
	end;
	v16.playerGui = l__Players__2.LocalPlayer:FindFirstChildOfClass("PlayerGui");
	if not v16.playerGui then
		v16.playerGuiAddedConn = l__Players__2.LocalPlayer.ChildAdded:Connect(function(p5)
			if p5:IsA("PlayerGui") then
				v16.playerGui = p5;
				v16:CreateTouchGuiContainer();
				v16.playerGuiAddedConn:Disconnect();
				v16.playerGuiAddedConn = nil;
				v16:OnLastInputTypeChanged(l__UserInputService__4:GetLastInputType());
			end;
		end);
		return v16;
	end;
	v16:CreateTouchGuiContainer();
	v16:OnLastInputTypeChanged(l__UserInputService__4:GetLastInputType());
	return v16;
end;
function v1.GetMoveVector(p6)
	if not p6.activeController then
		return Vector3.new(0, 0, 0);
	end;
	return p6.activeController:GetMoveVector();
end;
function v1.GetActiveController(p7)
	return p7.activeController;
end;
function v1.UpdateActiveControlModuleEnabled(p8)
	if not p8.activeController then
		return;
	end;
	if not p8.controlsEnabled then
		p8.activeController:Enable(false);
		if p8.moveFunction then
			p8.moveFunction(l__Players__2.LocalPlayer, Vector3.new(0, 0, 0), true);
		end;
		return;
	end;
	if not (not l__GuiService__5.TouchControlsEnabled) or not l__UserInputService__4.TouchEnabled or p8.activeControlModule ~= v15 and p8.activeControlModule ~= v14 and p8.activeControlModule ~= v11 then
		(function()
			if p8.activeControlModule == v15 then
				p8.activeController:Enable(true, l__Players__2.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice, p8.touchJumpController);
				return;
			end;
			if not p8.touchControlFrame then
				p8.activeController:Enable(true);
				return;
			end;
			p8.activeController:Enable(true, p8.touchControlFrame);
		end)();
		return;
	end;
	p8.activeController:Enable(false);
	if p8.moveFunction then
		p8.moveFunction(l__Players__2.LocalPlayer, Vector3.new(0, 0, 0), true);
	end;
end;
function v1.Enable(p9, p10)
	if p10 == nil then
		p10 = true;
	end;
	p9.controlsEnabled = p10;
	if not p9.activeController then
		return;
	end;
	p9:UpdateActiveControlModuleEnabled();
end;
function v1.Disable(p11)
	p11.controlsEnabled = false;
	p11:UpdateActiveControlModuleEnabled();
end;
local u4 = {
	[Enum.UserInputType.Keyboard] = v9,
	[Enum.UserInputType.MouseButton1] = v9,
	[Enum.UserInputType.MouseButton2] = v9,
	[Enum.UserInputType.MouseButton3] = v9,
	[Enum.UserInputType.MouseWheel] = v9,
	[Enum.UserInputType.MouseMovement] = v9,
	[Enum.UserInputType.Gamepad1] = v10,
	[Enum.UserInputType.Gamepad2] = v10,
	[Enum.UserInputType.Gamepad3] = v10,
	[Enum.UserInputType.Gamepad4] = v10
};
local u5 = nil;
local u6 = {
	[Enum.TouchMovementMode.DPad] = v11,
	[Enum.DevTouchMovementMode.DPad] = v11,
	[Enum.TouchMovementMode.Thumbpad] = v11,
	[Enum.DevTouchMovementMode.Thumbpad] = v11,
	[Enum.TouchMovementMode.Thumbstick] = v14,
	[Enum.DevTouchMovementMode.Thumbstick] = v14,
	[Enum.TouchMovementMode.DynamicThumbstick] = v11,
	[Enum.DevTouchMovementMode.DynamicThumbstick] = v11,
	[Enum.TouchMovementMode.ClickToMove] = v15,
	[Enum.DevTouchMovementMode.ClickToMove] = v15,
	[Enum.TouchMovementMode.Default] = v11,
	[Enum.ComputerMovementMode.Default] = v9,
	[Enum.ComputerMovementMode.KeyboardMouse] = v9,
	[Enum.DevComputerMovementMode.KeyboardMouse] = v9,
	[Enum.DevComputerMovementMode.Scriptable] = nil,
	[Enum.ComputerMovementMode.ClickToMove] = v15,
	[Enum.DevComputerMovementMode.ClickToMove] = v15
};
function v1.SelectComputerMovementModule(p12)
	if not l__UserInputService__4.KeyboardEnabled and not l__UserInputService__4.GamepadEnabled then
		return nil, false;
	end;
	local l__DevComputerMovementMode__17 = l__Players__2.LocalPlayer.DevComputerMovementMode;
	if l__DevComputerMovementMode__17 == Enum.DevComputerMovementMode.UserChoice then
		local v18 = u4[u5];
		if l__UserGameSettings__7.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove and v18 == v9 then
			v18 = v15;
		end;
	else
		v18 = u6[l__DevComputerMovementMode__17];
		if not v18 and l__DevComputerMovementMode__17 ~= Enum.DevComputerMovementMode.Scriptable then
			warn("No character control module is associated with DevComputerMovementMode ", l__DevComputerMovementMode__17);
		end;
	end;
	if v18 then
		return v18, true;
	end;
	if l__DevComputerMovementMode__17 == Enum.DevComputerMovementMode.Scriptable then
		return nil, true;
	end;
	return nil, false;
end;
function v1.SelectTouchModule(p13)
	if not l__UserInputService__4.TouchEnabled then
		return nil, false;
	end;
	local l__DevTouchMovementMode__19 = l__Players__2.LocalPlayer.DevTouchMovementMode;
	if l__DevTouchMovementMode__19 == Enum.DevTouchMovementMode.UserChoice then
		local v20 = u6[l__UserGameSettings__7.TouchMovementMode];
	else
		if l__DevTouchMovementMode__19 == Enum.DevTouchMovementMode.Scriptable then
			return nil, true;
		end;
		v20 = u6[l__DevTouchMovementMode__19];
	end;
	return v20, true;
end;
local function u7(p14, p15)
	local l__CurrentCamera__21 = l__Workspace__6.CurrentCamera;
	if not l__CurrentCamera__21 then
		return p15;
	end;
	if p14:GetState() == Enum.HumanoidStateType.Swimming then
		return l__CurrentCamera__21.CFrame:VectorToWorldSpace(p15);
	end;
	local v22 = l__CurrentCamera__21.CFrame;
	if l__VRService__8.VREnabled and p14.RootPart and (p14.RootPart.CFrame.Position - v22.Position).Magnitude < 3 then
		v22 = v22 * l__VRService__8:GetUserCFrame(Enum.UserCFrame.Head);
	end;
	local v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34 = v22:GetComponents();
	if v31 < 1 and v31 > -1 then
		local v35 = v34;
		local v36 = v28;
	else
		v35 = v26;
		v36 = -v27 * math.sign(v31);
	end;
	local v37 = math.sqrt(v35 * v35 + v36 * v36);
	return Vector3.new((v35 * p15.X + v36 * p15.Z) / v37, 0, (v35 * p15.Z - v36 * p15.X) / v37);
end;
function v1.OnRenderStepped(p16, p17)
	if p16.activeController and p16.activeController.enabled and p16.humanoid then
		p16.activeController:OnRenderStepped(p17);
		local v38 = p16.activeController:GetMoveVector();
		local v39 = p16.activeController:IsMoveVectorCameraRelative();
		local v40 = p16:GetClickToMoveController();
		if p16.activeController ~= v40 then
			if v38.magnitude > 0 then
				v40:CleanupPath();
			else
				v40:OnRenderStepped(p17);
				v38 = v40:GetMoveVector();
				v39 = v40:IsMoveVectorCameraRelative();
			end;
		end;
		if p16.vehicleController then
			local v41, v42 = p16.vehicleController:Update(v38, v39, p16.activeControlModule == v10);
			v38 = v41;
		end;
		if v39 then
			v38 = u7(p16.humanoid, v38);
		end;
		p16.moveFunction(l__Players__2.LocalPlayer, v38, false);
		p16.humanoid.Jump = p16.activeController:GetIsJumping() or p16.touchJumpController and p16.touchJumpController:GetIsJumping();
	end;
end;
function v1.OnHumanoidSeated(p18, p19, p20)
	if p19 then
		if p20 and p20:IsA("VehicleSeat") then
			if not p18.vehicleController then
				p18.vehicleController = p18.vehicleController.new(l__Value__3);
			end;
			p18.vehicleController:Enable(true, p20);
			return;
		end;
	elseif p18.vehicleController then
		p18.vehicleController:Enable(false, p20);
	end;
end;
function v1.OnCharacterAdded(p21, p22)
	p21.humanoid = p22:FindFirstChildOfClass("Humanoid");
	while not p21.humanoid do
		p22.ChildAdded:wait();
		p21.humanoid = p22:FindFirstChildOfClass("Humanoid");
	end;
	p21:UpdateTouchGuiVisibility();
	if p21.humanoidSeatedConn then
		p21.humanoidSeatedConn:Disconnect();
		p21.humanoidSeatedConn = nil;
	end;
	p21.humanoidSeatedConn = p21.humanoid.Seated:Connect(function(p23, p24)
		p21:OnHumanoidSeated(p23, p24);
	end);
end;
function v1.OnCharacterRemoving(p25, p26)
	p25.humanoid = nil;
	p25:UpdateTouchGuiVisibility();
end;
function v1.UpdateTouchGuiVisibility(p27)
	if p27.touchGui then
		p27.touchGui.Enabled = not (not p27.humanoid) and not (not l__GuiService__5.TouchControlsEnabled);
	end;
end;
local u8 = require(script:WaitForChild("TouchJump"));
function v1.SwitchToController(p28, p29)
	if not p29 then
		if p28.activeController then
			p28.activeController:Enable(false);
		end;
		p28.activeController = nil;
		p28.activeControlModule = nil;
		return;
	end;
	if not p28.controllers[p29] then
		p28.controllers[p29] = p29.new(l__Value__3);
	end;
	if p28.activeController ~= p28.controllers[p29] then
		if p28.activeController then
			p28.activeController:Enable(false);
		end;
		p28.activeController = p28.controllers[p29];
		p28.activeControlModule = p29;
		if p28.touchControlFrame and (p28.activeControlModule == v15 or p28.activeControlModule == v14 or p28.activeControlModule == v11) then
			if not p28.controllers[u8] then
				p28.controllers[u8] = u8.new();
			end;
			p28.touchJumpController = p28.controllers[u8];
			p28.touchJumpController:Enable(true, p28.touchControlFrame);
		elseif p28.touchJumpController then
			p28.touchJumpController:Enable(false);
		end;
		p28:UpdateActiveControlModuleEnabled();
	end;
end;
function v1.OnLastInputTypeChanged(p30, p31)
	if u5 == p31 then
		warn("LastInputType Change listener called with current type.");
	end;
	u5 = p31;
	if u5 == Enum.UserInputType.Touch then
		local v43, v44 = p30:SelectTouchModule();
		if v44 then
			while not p30.touchControlFrame do
				wait();
			end;
			p30:SwitchToController(v43);
		end;
	elseif u4[u5] ~= nil then
		local v45 = p30:SelectComputerMovementModule();
		if v45 then
			p30:SwitchToController(v45);
		end;
	end;
	p30:UpdateTouchGuiVisibility();
end;
function v1.OnComputerMovementModeChange(p32)
	local v46, v47 = p32:SelectComputerMovementModule();
	if v47 then
		p32:SwitchToController(v46);
	end;
end;
function v1.OnTouchMovementModeChange(p33)
	local v48, v49 = p33:SelectTouchModule();
	if v49 then
		while not p33.touchControlFrame do
			wait();
		end;
		p33:SwitchToController(v48);
	end;
end;
function v1.CreateTouchGuiContainer(p34)
	if p34.touchGui then
		p34.touchGui:Destroy();
	end;
	p34.touchGui = Instance.new("ScreenGui");
	p34.touchGui.Name = "TouchGui";
	p34.touchGui.ResetOnSpawn = false;
	p34.touchGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling;
	p34:UpdateTouchGuiVisibility();
	p34.touchControlFrame = Instance.new("Frame");
	p34.touchControlFrame.Name = "TouchControlFrame";
	p34.touchControlFrame.Size = UDim2.new(1, 0, 1, 0);
	p34.touchControlFrame.BackgroundTransparency = 1;
	p34.touchControlFrame.Parent = p34.touchGui;
	p34.touchGui.Parent = p34.playerGui;
end;
function v1.GetClickToMoveController(p35)
	if not p35.controllers[v15] then
		p35.controllers[v15] = v15.new(l__Value__3);
	end;
	return p35.controllers[v15];
end;
return v1.new();


Prompt: -- Runs when a round finishes. Reloads all players back into the lobby, removing tools and listeners.

Response:
function PlayerManager:ResetPlayers()
	for _, player in ipairs(PlayerManager.ActivePlayers) do
		print(player.Name)
		CheckpointEvent:FireClient(player, {{"raceFinished"}})
		CheckpointEvent:FireClient(player, {{"reset"}})
		PlayerConverter:SpeederToPlayerServer(player)
	end
	PlayerManager.ActivePlayers = {}
end


Prompt:
--[[
		___      _______                _
	   / _ |____/ ___/ /  ___ ____ ___ (_)__
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]

Response:
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 on = 0
local throt=0
local redline=0

script:WaitForChild("Super")

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

handler:FireServer("newSound","Super",car.DriveSeat,script.Super.SoundId,0,script.Super.Volume,true)
handler:FireServer("playSound","Super")
car.DriveSeat:WaitForChild("Super")

while wait() do
	local _RPM = script.Parent.Values.RPM.Value

	if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
		throt = math.max(.3,throt-.2)
	else
		throt = math.min(1,throt+.1)
	end
	if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
		redline=.5
	else
		redline=1
	end
	if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
	local Pitch = math.max((((script.Super.SetPitch.Value + script.Super.SetSuper.Value*_RPM/_Tune.Redline))*on^2),script.Super.SetPitch.Value)
	if FE then
		handler:FireServer("updateSound","Super",script.Super.SoundId,Pitch,script.Super.Volume)
	else
		car.DriveSeat.Super.Pitch = Pitch
	end
end


Prompt:
--[[
	Remove all art placed by a player.
]]

Response:
function PlayerSpots:cleanup(player)
	self:_removeUnusedSpots(player)

	for _, placed in ipairs(self.placedSpots) do
		placed.spot:removeArt()
	end

	self.placedSpots = {}
end

function PlayerSpots:_hasArtOnCanvas(canvas)
	for _, placed in ipairs(self.placedSpots) do
		if placed.canvas == canvas then
			return true
		end
	end

	return false
end

function PlayerSpots:_assignRandomSpot(canvas)
	local isSuccess, spot = canvas:getEmptySpot()
	if not isSuccess then
		warn("Cannot find an empty slot in canvas")
		return false, constants.Errors.SpotNotAvailable
	end

	table.insert(self.placedSpots, {
		canvas = canvas,
		spot = spot,
		createdAt = DateTime.now().UnixTimestamp,
	})

	return true, spot
end

function PlayerSpots:_removeOldestArt()
	self.toRemove = 1
end

function PlayerSpots:_removeOldestArtFromCanvas(canvas)
	local toRemove = nil
	for i, placed in ipairs(self.placedSpots) do
		if placed.canvas == canvas then
			-- A spot previously placed by the user has to be freed immediately
			toRemove = i
			placed.spot:removeArt()
			break
		end
	end

	table.remove(self.placedSpots, toRemove)
end

function PlayerSpots:_removeOldestArtFromOtherCanvas(currentCanvas)
	for i, placed in ipairs(self.placedSpots) do
		if placed.canvas ~= currentCanvas then
			self.toRemove = i
			break
		end
	end
end

function PlayerSpots:_removeUnusedSpots(player)
	self.placedSpots = Cryo.List.filter(self.placedSpots, function(placedSpot)
		return placedSpot.spot:hasArt() and placedSpot.spot.ownerUserId == player.UserId
	end)
end

return PlayerSpots


Prompt:
--[=[
	Clears the custom value for the given players. This
	just loops through the list of players and calls
	the `ClearFor` method for each player.
]=]

Response:
function RemoteProperty:ClearForList(players: { Player })
	for _, player in ipairs(players) do
		self:ClearFor(player)
	end
end


Prompt:
-- when a spring has displacement and velocity below +/- epsilon, the spring
-- won't send updates

Response: local MOVEMENT_EPSILON = 0.0001


Prompt: -- Dark was here.

Response:
local nearplayer
local Players = game:GetService("Players")
function MoveShelly()

	nearplayer = false

	for _,Player in next, Players:GetPlayers() do
		if Player.Character and Player.Character.PrimaryPart then
			local dis = (Player.Character.PrimaryPart.CFrame.Position - shelly.PrimaryPart.CFrame.Position).Magnitude
			if dis >= 500 then
				nearplayer = true
				break
			end
		end
	end

	if nearplayer then
		task.wait(math.random(8, 8 + 8/2))
		return
	end

	bp.Parent = shelly.PrimaryPart
	local goal
	repeat
	local ray = Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether), shelly.PrimaryPart.Position.Y+100, origin.p.z+math.random(-tether,tether)),Vector3.new(0,-130,0))
	local part,pos,norm,mat = workspace:FindPartOnRay(ray, shelly)
	if part == workspace.Terrain and mat ~= Enum.Material.Water then
		goal = pos+Vector3.new(0,.35,0)
	end
	task.wait()
	until goal
	--Set new goal for banto to MoveTo :)
	local pos = shelly.PrimaryPart.Position
	local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
	bg.CFrame = cf
	bp.Position = (cf*CFrame.new(0,0,-100)).p

	local start = tick()
	repeat task.wait(.5)
	local ray = Ray.new(shelly.PrimaryPart.Position, Vector3.new(0,-140,0))

	until (shelly.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >15 or not shellyGood
	if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
	bp.Parent = nil
	task.wait(math.random(3,8))
end

local soundBank = game.ServerStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
	if shellyGood then
		bp.Parent,bg.Parent= nil,nil
		shelly.PrimaryPart.Transparency =1
		shelly.PrimaryPart.CanCollide = false
		shelly.Shell.Transparency = 1
		shelly.HitShell.Transparency = 0
		shelly.HitShell.CanCollide = true
		shellyGood = false
		ostrich = os.clock()
		shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
		local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
		hitSound.PlayOnRemove = true
		hitSound.Parent = shelly.PrimaryPart
		task.wait()
		hitSound:Destroy()

		repeat task.wait() until os.clock()-ostrich > 10
		shelly.PrimaryPart.Transparency = 0
		shelly.PrimaryPart.CanCollide = true
		shelly.Shell.Transparency = 0
		shelly.HitShell.Transparency = 1
		shelly.HitShell.CanCollide = false
		bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
		shellyGood = true
	end
end)

while true do
	if shellyGood then
		MoveShelly()
	else
		task.wait(1)
	end
end


Prompt:
--[[
	Configuration
]]

Response:
local MAX_CUTTOFF_DISTANCE = 12
local ACTIVATE_KEYBOARD = Enum.KeyCode.E
local ACTIVATE_CONSOLE = Enum.KeyCode.ButtonX
local ACTION_BUTTON_OFFSET = Vector2.new(0, 0)
local ACTION_PRIORITY = 10000


Prompt: --Modules--

Response:
local modules = script.Parent.Modules
local core = require(modules.Core)
local combat = require(modules.Combat)
local flight = require(modules.Flight)
local pathing = require(modules.Pathing)
local troubleshoot = require(modules.Troubleshoot)


Prompt: -- Reference

Response:
local soundService = game:GetService("SoundService")
local chat = game:GetService("Chat")
local players = game:GetService("Players")
local lighting = game:GetService("Lighting")


Prompt:
--[=[
	Based on the given [UserInputType], a cooresponding enum representing the
	current device is returned.

	```lua
	getCurrentDevice(Enum.UserInputType.KeyCode) -- "Computer"
	getCurrentDevice(Enum.UserInputType.Touch) -- "Mobile"
	getCurrentDevice(Enum.UserInputType.Gamepad1) -- "Gamepad"
	```

	@within Modules
]=]

Response:
local function getCurrentDevice(inputType: Enum.UserInputType)
	for group, patterns in pairs(constants.DeviceInputTypePatterns) do
		for _, pattern in ipairs(patterns) do
			if inputType.Name:match(pattern) then
				return enums.Device[group]
			end
		end
	end

	return enums.Device.Unknown
end

return getCurrentDevice


Prompt:
--[=[
	Debounce a existing function by timeout

	@class throttle
]=]

Response:
local require = require(script.Parent.loader).load(script)

local ThrottledFunction = require("ThrottledFunction")


Prompt:
--[[
	Returns the current value of this Tween object.
	The object will be registered as a dependency unless `asDependency` is false.
]]

Response:
function class:get(asDependency: boolean?): any
	if asDependency ~= false then
		Dependencies.useDependency(self)
	end
	return self._currentValue
end


Prompt: --//ENGINE//--

Response:
Horsepower = 1500  --{This is how much power your engine block makes ALONE, this does not represent to total horsepower output [IF you have a turbo/SC]}
EngineDisplacement = 2200 --{Engine size in CC's}
EngineType =  "Petrol" --{Petrol, Diesel, Electric]
EngineLocation = "Front" --{Front, Mid, Rear}
ForcedInduction = "Supercharger" --{Natural, Single, Twin, Supercharger}
InductionPartSize = 1 --{0-5, 1 being small, 5 being large (Decimals accepted, e.g 2.64 turbo size, this is the size of the turbo}
ElectronicallyLimited = false --{Electronically Limit the top speed of your vehicle}
LimitSpeedValue = 236.121 --{Limits top speed of the vehicle [In MPH]}


Prompt: -- This is for commands which continue on respawn

Response: local module = {}


Prompt: --- Skill

Response:
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://4835590095"

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Z and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = false
		Tool.Active.Value = "SunaTornado"
		wait(0.1)
		Track1 = Player.Character.Humanoid:LoadAnimation(Animation)
		Track1:Play()
		wait(0.15)
		script.Fire:FireServer(plr)
	local hum =  Player.Character.Humanoid
	for i = 1,30 do
		wait()
		hum.CameraOffset = Vector3.new(
			math.random(-1,1),
			math.random(-1,1),
			math.random(-1,1)
		)
	end
	hum.CameraOffset = Vector3.new(0,0,0)
	    wait(0.15)
		Tool.Active.Value = "None"
		wait(2)
		Debounce = true
	end
end)


Prompt: --[[Susupension]]

Response:
	Tune.SusEnabled		= false		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled

	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FPreCompress	= .4		-- Pre-compression adds resting length force
	Tune.FExtensionLim	= .4		-- Max Extension Travel (in studs)
	Tune.FCompressLim	= .4		-- 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	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

	Tune.RSusLength		= 2			-- Suspension length (in studs)
	Tune.RPreCompress	= .4		-- Pre-compression adds resting length force
	Tune.RExtensionLim	= .4		-- Max Extension Travel (in studs)
	Tune.RCompressLim	= .4		-- 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		= true			-- 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


Prompt: --Both

Response:
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


Prompt:
-- if version < SNAPSHOT_VERSION then
-- 	return Error(
-- 		chalk.red(
-- 			chalk.red.bold('Outdated snapshot') .. ": The version of the snapshot " ..
-- 			"file associated with this test is outdated. The snapshot file " ..
-- 			"version ensures that all developers on a project are using " ..
-- 			"the same version of Jest. " ..
-- 			"Please update all snapshots during this upgrade of Jest.\n\n"
-- 		) ..
-- 		"Expected: v" .. SNAPSHOT_VERSION .. "\n" ..
-- 		"Received: v" .. version .. "\n\n" ..
-- 		SNAPSHOT_VERSION_WARNING
-- 	)
-- end


Prompt: -- modules

Response:
local module	= {}

function module.Create(self, item)
	local itemModule	= {
		Item		= item;
		Equipped	= false;
		Connections	= {};
	}

	-- variables

	local animations	= {}

	local character	= item.Parent.Parent
	local handle	= item:WaitForChild("Handle")
	local muzzle	= handle:WaitForChild("Muzzle")

	local config		= CONFIG:GetConfig(item)
	local canShoot		= true
	local clicking		= false
	local reloading		= false
	local rCancelled	= false
	local equipTime		= 0

	local ammo	= item:WaitForChild("Ammo").Value

	local aiming	= false

	-- functions

	local function CanShoot()
		return itemModule.Equipped and canShoot and ammo > 0
	end

	local function Reload()
		if (not reloading) and itemModule.Equipped and ammo < config.Magazine then
			reloading	= true
			rCancelled	= false

			local storedAmmo	= character.Ammo[config.Size].Value
			if storedAmmo > 0 then
				MOUSE.Reticle	= "Reloading"
				REMOTES.Reload:FireServer(item)
				EFFECTS:Effect("Reload", item)
				animations.Reload:Play(0.1, 1, 1/config.ReloadTime)

				local start		= tick()
				local elapsed	= 0
				repeat
					elapsed	= tick() - start
					RunService.Stepped:wait()
				until elapsed >= config.ReloadTime or rCancelled or (not itemModule.Equipped)

				animations.Reload:Stop()

				if itemModule.Equipped then
					if elapsed >= config.ReloadTime then
						local magazine	= config.Magazine
						local needed	= magazine - ammo

						if storedAmmo >= needed then
							ammo	= ammo + needed
						else
							ammo	= ammo + storedAmmo
						end
					end

					MOUSE.Reticle	= config.Reticle or "Gun"
					EVENTS.Gun:Fire("Update", ammo)
				end
			end
			reloading	= false
		end
	end

	local function Shoot()
		ammo	= ammo - 1
		local position		= muzzle.WorldPosition
		local directions	= {}

		for i = 1, config.ShotSize do
			local spread	= config.Spread * 10
			local cframe	= CFrame.new(position, MOUSE.WorldPosition)

			if config.SpreadPattern then
				local x, y	= config.SpreadPattern[i][1], config.SpreadPattern[i][2]
				cframe		= cframe * CFrame.Angles(math.rad(spread * y / 50), math.rad(spread * x / 50), 0)
			else
				cframe		= cframe * CFrame.Angles(math.rad(math.random(-spread, spread) / 50), math.rad(math.random(-spread, spread) / 50), 0)
			end

			local direction	= cframe.lookVector
			table.insert(directions, direction)

			local hit, pos, normal, humanoid	= Raycast(position, direction * config.Range, {character})

			if hit and humanoid then
				if DAMAGE:PlayerCanDamage(PLAYER, humanoid) then
					local damage	= DAMAGE:Calculate(item, hit, position)
					local armor		= (humanoid:FindFirstChild("Armor") and humanoid.Armor.Value > 0)
					EVENTS.Hitmarker:Fire(pos, damage, armor, hit.Name == "Head")
					REMOTES.Hit:FireServer(hit, i)
				end
			end
		end

		if aiming then
			animations.AimShoot:Play(0, math.random(5, 10) / 10, 1)
		else
			animations.Shoot:Play(0, math.random(5, 10) / 10, 1)
		end

		EVENTS.Gun:Fire("Update", ammo)
		EFFECTS:Effect("Shoot", item, position, directions, ammo)
		REMOTES.Shoot:FireServer(item, position, directions)

		EVENTS.Recoil:Fire(Vector3.new(math.random(-config.Recoil, config.Recoil) / 4, 0, math.random(config.Recoil / 2, config.Recoil)))
	end

	-- module functions

	function itemModule.Connect(self)
		local character		= PLAYER.Character
		local humanoid		= character:WaitForChild("Humanoid")

		for _, animation in pairs(self.Item:WaitForChild("Animations"):GetChildren()) do
			animations[animation.Name]	= humanoid:LoadAnimation(animation)
		end

		table.insert(self.Connections, INPUT.ActionBegan:connect(function(action, processed)
			if self.Equipped and (not processed) then
				if action == "Reload" then
					Reload()
				end
			end
		end))

		table.insert(self.Connections, item.Attachments.ChildAdded:connect(function()
			config	= CONFIG:GetConfig(item)
			if self.Equipped then
				EVENTS.Zoom:Fire(config.Zoom)
				EVENTS.Scope:Fire(config.Scope)
			end
		end))

		table.insert(self.Connections, item.Attachments.ChildRemoved:connect(function()
			config	= CONFIG:GetConfig(item)
			if self.Equipped then
				EVENTS.Zoom:Fire(config.Zoom)
				EVENTS.Scope:Fire(config.Scope)
			end
		end))

		table.insert(self.Connections, EVENTS.Aim.Event:connect(function(a)
			aiming	= a

			if self.Equipped then
				if aiming then
					animations.Idle:Stop()
					animations.Aim:Play()
				else
					animations.Aim:Stop()
					animations.Idle:Play()
				end
			end
		end))
	end

	function itemModule.Disconnect(self)
		for _, connection in pairs(self.Connections) do
			connection:Disconnect()
		end
		self.Connections	= {}
	end

	function itemModule.Equip(self)
		EVENTS.Zoom:Fire(config.Zoom)
		EVENTS.Scope:Fire(config.Scope)
		MOUSE.Reticle	= config.Reticle or "Gun"
		if aiming then
			animations.Aim:Play()
		else
			animations.Idle:Play()
		end
		animations.Equip:Play(0, 1, 1)

		ammo	= item.Ammo.Value

		EVENTS.Gun:Fire("Enable", config.Size, ammo)

		self.Equipped	= true
		equipTime		= tick()

		if ammo == 0 then
			spawn(function()
				Reload()
			end)
		end
	end

	function itemModule.Unequip(self)
		EVENTS.Zoom:Fire()
		EVENTS.Scope:Fire(false)
		MOUSE.Reticle	= "Default"

		for _, animation in pairs(animations) do
			animation:Stop()
		end

		EVENTS.Gun:Fire("Disable", config.Size, ammo)

		self.Equipped	= false
	end

	function itemModule.Activate(self)
		clicking	= true

		if tick() - equipTime >= EQUIP_COOLDOWN then
			if config.FireMode == "Semi" then
				if CanShoot() then
					rCancelled	= true
					canShoot	= false
					Shoot()
					wait(1 / config.FireRate)
					canShoot	= true
				end
			elseif config.FireMode == "Auto" then
				while clicking and CanShoot() do
					rCancelled	= true
					canShoot	= false
					Shoot()
					wait(1 / config.FireRate)
					canShoot	= true
				end
			elseif config.FireMode == "Burst" then
				while clicking and CanShoot() do
					canShoot	= false
					for i = 1, config.BurstAmount do
						if clicking and ammo > 0 then
							rCancelled	= true
							Shoot()
							wait(1 / config.BurstRate)
						else
							break
						end
					end
					wait(1 / config.FireRate)
					canShoot	= true
				end
			end
			if ammo == 0 then
				Reload()
			end
		end
	end

	function itemModule.Deactivate(self)
		clicking	= false
	end

	return itemModule
end

return module


Prompt: --- Add sounds when interacting with a gui element

Response:
return function(element, interactType, interactSoundId, interactSoundVolume, enableRandomPitch)
	--- Variables
	interactType = string.lower(interactType)
	interactSoundVolume = interactSoundVolume or 0.15
	enableRandomPitch = enableRandomPitch or false
	--
	local events = {}

	--- Events
	if interactType == "mousedown" then
		--- Mouse down
		events[#events + 1] = element.MouseButton1Down:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume * 2)
		end)

	elseif interactType == "mouseup" then
		--- Mouse up
		events[#events + 1] = element.MouseButton1Up:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume * 2)
		end)

	elseif interactType == "mouseenter" then
		--- Mouse hover over
		events[#events + 1] = element.MouseEnter:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
		end)

	elseif interactType == "mouseleave" then
		--- Mouse hover leave
		events[#events + 1] = element.MouseLeave:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
		end)

	elseif interactType == "mouseclick" then
		--- Mouse click
		events[#events + 1] = element.MouseButton1Click:Connect(function()
			_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
		end)
	end

	--- Return function to cancel this behavior
	return function()
		for _, event in ipairs(events) do
			event:disconnect()
		end
		events = nil
	end
end


Prompt: --Place this INSIDE the model. Don't replace the model name or anything.

Response:
------------------------------------------------------------------------------------------

object = script.Parent

if (object ~= nil) and (object ~= game.Workspace) then

model = object

backup = model:clone() -- Make the backup

waitTime = 60 --Time to wait between regenerations


Prompt: -- / UIs / --

Response: local CutsceneFrame = CutsceneGui.CutsceneFrame


Prompt: --Put the used services into variables

Response:
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")


Prompt:
-- @Context Server
-- Given a weapon definition, position, and direction. A projectile will be simulated on all clients.
-- @param WeaponDefinition weaponDefinition
-- @param Vector3 position
-- @param Vector3 direction
-- @param Player _owner

Response:
function ProjectileReplication.ReplicateProjectile(weaponDefinition, position, direction, _owner)
	if RunService:IsServer() then
		--print("Sending visual to all clients",weaponDefinition, position, direction, _owner)
		-- If the server makes the request to replicate a projectile then then this is sent to everyone besides the sender
		RE_CreateProjectile:FireAllClients(weaponDefinition:GetIDName(), position, direction, _owner)
	end
end


Prompt:
-- Parses all folders and their child. Folders will be recursively searched.
---@param folder instance

Response:
function Database.ParseFolder(folder)
    local dataRoot = {}
    Database._Parse_R(dataRoot,folder,dataRoot)
    -- Store the data onto the database.
	Database[folder.name] = dataRoot
end


Prompt: --		print(AnimName .. " * " .. Index .. " [" .. OrigRoll .. "]")

Response:
		local Anim = AnimTable[AnimName][Index].Anim

		-- load it to the humanoid; get AnimationTrack
		ToolAnimTrack = Humanoid:LoadAnimation(Anim)

		-- play the animation
		ToolAnimTrack:Play(TransitionTime)
		ToolAnimName = AnimName

		CurrentToolAnimKeyframeHandler = ToolAnimTrack.KeyframeReached:connect(ToolKeyframeReachedFunc)
	end
end

function StopToolAnimations()
	local OldAnim = ToolAnimName

	if CurrentToolAnimKeyframeHandler then
		CurrentToolAnimKeyframeHandler:disconnect()
	end

	ToolAnimName = ""
	if ToolAnimTrack then
		ToolAnimTrack:Stop()
		ToolAnimTrack:Destroy()
		ToolAnimTrack = nil
	end

	return OldAnim
end


Prompt:
--// This method is to be used with the new filter API. This method takes the
--// TextFilterResult objects and converts them into the appropriate string
--// messages for each player.

Response:
function methods:InternalSendFilteredMessageWithFilterResult(inMessageObj, channelName)
	local messageObj = ShallowCopy(inMessageObj)

	local oldFilterResult = messageObj.FilterResult
	local player = self:GetPlayer()

	local msg = ""
	pcall(function()
		if (messageObj.IsFilterResult) then
			if (player) then
				msg = oldFilterResult:GetChatForUserAsync(player.UserId)
			else
				msg = oldFilterResult:GetNonChatStringForBroadcastAsync()
			end
		else
			msg = oldFilterResult
		end
	end)

	--// Messages of 0 length are the result of two users not being allowed
	--// to chat, or GetChatForUserAsync() failing. In both of these situations,
	--// messages with length of 0 should not be sent.

	if UserFlagRemoveMessageOnTextFilterFailures then
		messageObj.Message = msg
		messageObj.FilterResult = nil
		self:InternalSendFilteredMessage(messageObj, channelName)
	else
		if (#msg > 0) then
			messageObj.Message = msg
			messageObj.FilterResult = nil
			self:InternalSendFilteredMessage(messageObj, channelName)
		end
	end
end

function methods:InternalSendSystemMessage(messageObj, channelName)
	local success, err = pcall(function()
		self:LazyFire("eReceivedSystemMessage", messageObj, channelName)
		if self.PlayerObj then
			self.EventFolder.OnNewSystemMessage:FireClient(self.PlayerObj, messageObj, channelName)
		end
	end)
	if not success and err then
		print("Error sending internal system message: " ..err)
	end
end

function methods:UpdateChannelNameColor(channelName, channelNameColor)
	self:LazyFire("eChannelNameColorUpdated", channelName, channelNameColor)
	if self.PlayerObj then
		self.EventFolder.ChannelNameColorUpdated:FireClient(self.PlayerObj, channelName, channelNameColor)
	end
end


Prompt: -- please do not distribute this plugin and pass it as yours

Response:
WheelModel = script.Parent:WaitForChild("Wheels")
rainEffect = script:WaitForChild("RainEffect")
wheels = {}
touchingparts = {}

for i, v in pairs(WheelModel:GetChildren()) do
	if v:IsA("BasePart") then
		table.insert(wheels, v)
		rainEffect:Clone().Parent = v
		table.insert(touchingparts, nil)
	end
end
for i, v in pairs(wheels) do
	v.Touched:connect(function(part)
		touchingparts[i] = part
	end)
end
RunService = game:GetService("RunService")

RunService.Heartbeat:connect(function()
	for i, v in pairs(wheels) do
		local speed = v.Velocity.magnitude
		if speed > 20 then
			if touchingparts[i].Material == Enum.Material.Glass or touchingparts[i].Material == Enum.Material.Ice then
				v.RainEffect.Rate = 5/100 * speed * 10
			else
				v.RainEffect.Rate = 0
			end
		else
			v.RainEffect.Rate = 0
		end
	end
end)


Prompt: -- Signal types

Response:
export type Connection = {
	Disconnect: (self: Connection) -> (),
	Destroy: (self: Connection) -> (),
	Connected: boolean,
}

export type Signal<T...> = {
	Fire: (self: Signal<T...>, T...) -> (),
	FireDeferred: (self: Signal<T...>, T...) -> (),
	Connect: (self: Signal<T...>, fn: (T...) -> ()) -> Connection,
	Once: (self: Signal<T...>, fn: (T...) -> ()) -> Connection,
	DisconnectAll: (self: Signal<T...>) -> (),
	GetConnections: (self: Signal<T...>) -> { Connection },
	Destroy: (self: Signal<T...>) -> (),
	Wait: (self: Signal<T...>) -> T...,
}


Response:
game.Workspace.crewview1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crew2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crew3.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""


Response:
script.Parent.Values.RPM.Changed:connect(function()
	intach.Rotation = -65 + script.Parent.Values.RPM.Value * 250 / 8000
end)

script.Parent.Values.Velocity.Changed:connect(function(property)
	inspd.Rotation = -30 + (440 / 160) * (math.abs(script.Parent.Values.Velocity.Value.Magnitude*((10/12) * (50/88))))
end)

script.Parent.Values.Gear.Changed:connect(function()
	local gearText = script.Parent.Values.Gear.Value
	if gearText == 0 then
		gearText = "N"
		car.Body.Dash.DashSc.G.Gear.Text = "N"
		car.DriveSeat.Filter:FireServer('reverse',false)
	elseif gearText == -1 then
		gearText = "R"
		car.Body.Dash.DashSc.G.Gear.Text = "R"
		car.DriveSeat.Filter:FireServer('reverse',true)
	end
	car.Body.Dash.DashSc.G.Gear.Text = gearText
end)

script.Parent.Values.PBrake.Changed:connect(function()
	dash.PBrake.Visible = script.Parent.Values.PBrake.Value
end)

local car = script.Parent.Car.Value
local Values = script.Parent.Values
local _Tune = require(car["A-Chassis Tune"])

game["Run Service"].Stepped:connect(function()
	local rev = (Values.RPM.Value/_Tune.Redline)
	local MPHScale = (10/12) * (60/88)
	local KPHScale = (10/12) * 1.09728
	local Speed = Values.Velocity.Value.Magnitude
	car.Body.Gauges.Screen.FPGauges.Gauge.RPMFrame.Fill.Size = UDim2.new(rev,0,1,0)
	car.Body.Gauges.Screen.FPGauges.Gauge.Gear.Gear.Text = Values.Gear.Value
	car.Body.Gauges.Screen.FPGauges.Gauge.Speed.MPH.Text = " ".. math.floor(Speed*MPHScale)
	car.Body.Gauges.Screen.FPGauges.Gauge.Speed.KPH.Text = "  ".. math.floor(Speed*KPHScale)
end)


Prompt: --- Setting Fire ---

Response:
local fire = script.Fire
fire.Parent = pellet
fire.Enabled = true
damage = 10

local DebrisService = game:GetService('Debris')

function TagHumanoid(humanoid, vPlayer)
	-- Add more tags here to customize what tags are available.
	local creatorTag = Instance.new("ObjectValue")
	creatorTag.Value = vPlayer
	creatorTag.Name = "creator"
	creatorTag.Parent = humanoid
	DebrisService:AddItem(creatorTag, 1.5)
end

function FireScript(human)
	if human.Parent.Torso:FindFirstChild("FIRE")~= nil then
	else
		local FireBurn = script.FIRE:Clone()
		FireBurn.Parent = human.Parent.Torso
		FireBurn.FireDamage.Disabled = false
	end
end

function onTouched(hit)
	if hit and hit.Parent then
		if HitPeople[hit.Parent.Name] then


Prompt: --use this to determine if you want this human to be harmed or not, returns boolean

Response:
function checkTeams(otherHuman)
	return not (sameTeam(otherHuman) and not FriendlyFire==true)
end

function boom()
	wait(1.5)
	Used = true
	Object.Anchored = true
	Object.CanCollide = false
	Object.Sparks.Enabled = false
	Object.Orientation = Vector3.new(0,0,0)
	Object.Transparency = 1
	Object.Fuse:Stop()
	Object.Explode:Play()
	Object.Dist:Play()
	Object.Explosion:Emit(30)
	Object.Smoke1:Emit(30)
	Object.Smoke2:Emit(30)
	Object.Debris:Emit(10)
	Object.exlight:Emit(2)
	Object.dust:Emit(50)
	Beps.Transparency = 1
	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()


Prompt: --Made by Luckymaxer

Response:
Debris = game:GetService("Debris")

Creator = script:FindFirstChild("Creator")
Tool = script:FindFirstChild("Tool")
Model = script:WaitForChild("Model")

function DestroyModel()
	if Model and Model.Parent then
		Debris:AddItem(Model, 2)
	end
	Debris:AddItem(script, 2)
end

if not Creator or not Creator.Value or not Creator.Value:IsA("Player") or not Creator.Value.Parent or not Tool or not Tool.Value or not Tool.Value.Parent or not Model or not Model.Value then
	DestroyModel()
	return
end

Creator = Creator.Value
Tool = Tool.Value
Model = Model.Value

Character = Creator.Character
if not Character then
	DestroyModel()
	return
end

Creator.Changed:connect(function(Property)
	if Property == "Parent" and not Creator.Parent then
		DestroyModel()
	end
end)

Character.Changed:connect(function(Property)
	if Property == "Parent" and not Character.Parent then
		DestroyModel()
	end
end)

Tool.Changed:connect(function(Property)
	if Property == "Parent" then
		DestroyModel()
	end
end)

Model.Changed:connect(function(Property)
	if Property == "Parent" and not Model.Parent then
		DestroyModel()
	end
end)


Prompt: -- See if I have a tool

Response:
local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
   Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
	if part and part.Parent and part.Parent:IsA("Tool") then
		tool = part.Parent
		break
	end
end

local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
	if configTable:FindFirstChild(configName) then
		configs[configName] = configTable:FindFirstChild(configName).Value
	else
		configs[configName] = defaultValue
	end
end

loadConfig("SpawnCooldown", 5)

if tool then
	tool.Parent = game.ServerStorage

	while true do
		-- put tool on pad
		local toolCopy = tool:Clone()
		local handle = toolCopy:FindFirstChild("Handle")
		toolCopy.Parent = game.Workspace
		local toolOnPad = true
		local parentConnection
		parentConnection = toolCopy.AncestryChanged:connect(function()
			if handle then handle.Anchored = false end
			toolOnPad = false
			parentConnection:disconnect()
		end)
		if handle then
			print("removed spin")
			handle.Anchored = true
		end
		-- wait for tool to be removed
		while toolOnPad do
			if handle then
				print("removed spinning")
			end
			wait()
		end

		-- wait for cooldown
		wait(configs["SpawnCooldown"])
	end

end


Prompt:
-- This decides what to do if detection is 'Automatic'
-- This is placed in ZoneController instead of the Zone object due to the ZoneControllers all-knowing group-minded logic

Response:
function ZoneController.updateDetection(zone)
	local detectionTypes = {
		["enterDetection"] = "_currentEnterDetection",
		["exitDetection"] = "_currentExitDetection",
	}
	for detectionType, currentDetectionName in pairs(detectionTypes) do
		local detection = zone[detectionType]
		if detection == enum.Detection.Automatic then
			if charactersTotalVolume > WHOLE_BODY_DETECTION_LIMIT then
				detection = enum.Detection.Centre
			else
				detection = enum.Detection.WholeBody
			end
		end
		zone[currentDetectionName] = detection
	end
end

function ZoneController._formHeartbeat(registeredTriggerType)
	local heartbeatConnection = heartbeatConnections[registeredTriggerType]
	if heartbeatConnection then return end
	-- This will only ever connect once per triggerType per server
	-- This means instead of initiating a loop per-zone we can handle everything within
	-- a singular connection. This is particularly beneficial for player-orinetated
	-- raycasting, where a raycast only needs to be cast once per interval, as apposed
	-- to every zone per interval
	-- I utilise heartbeat with os.clock() to provide precision (where needed) and flexibility
	local nextCheck = 0
	heartbeatConnection = heartbeat:Connect(function()
		local clockTime = os.clock()
		if clockTime >= nextCheck then
			local lowestAccuracy
			local lowestDetection
			for zone, _ in pairs(activeZones) do
				if zone.activeTriggers[registeredTriggerType] then
					local zAccuracy = zone.accuracy
					if lowestAccuracy == nil or zAccuracy < lowestAccuracy then
						lowestAccuracy = zAccuracy
					end
					ZoneController.updateDetection(zone)
					local zDetection = zone._currentEnterDetection
					if lowestDetection == nil or zDetection < lowestDetection then
						lowestDetection = zDetection
					end
				end
			end
			local highestAccuracy = lowestAccuracy
			local zonesAndOccupants = heartbeatActions[registeredTriggerType](lowestDetection)
			for zone, _ in pairs(activeZones) do
				if zone.activeTriggers[registeredTriggerType] then
					local zAccuracy = zone.accuracy
					local occupantsDict = zonesAndOccupants[zone] or {}
					local occupantsPresent = false
					for k,v in pairs(occupantsDict) do
						occupantsPresent = true
						break
					end
					if occupantsPresent and zAccuracy > highestAccuracy then
						highestAccuracy = zAccuracy
					end
					zone:_updateOccupants(registeredTriggerType, occupantsDict)
				end
			end
			----
			local cooldown = enum.Accuracy.getProperty(highestAccuracy)
			nextCheck = clockTime + cooldown
			----
		end
	end)
	heartbeatConnections[registeredTriggerType] = heartbeatConnection
end

function ZoneController._deregisterConnection(registeredZone, registeredTriggerType)
	activeConnections -= 1
	if activeTriggers[registeredTriggerType] == 1 then
		activeTriggers[registeredTriggerType] = nil
		local heartbeatConnection = heartbeatConnections[registeredTriggerType]
		if heartbeatConnection then
			heartbeatConnections[registeredTriggerType] = nil
			heartbeatConnection:Disconnect()
		end
	else
		activeTriggers[registeredTriggerType] -= 1
	end
	registeredZone.activeTriggers[registeredTriggerType] = nil
	if dictLength(registeredZone.activeTriggers) == 0 then
		activeZones[registeredZone] = nil
		ZoneController._updateZoneDetails()
	end
	if registeredZone.touchedConnectionActions[registeredTriggerType] then
		registeredZone:_disconnectTouchedConnection(registeredTriggerType)
	end
end

function ZoneController._updateZoneDetails()
	activeParts = {}
	activePartToZone = {}
	allParts = {}
	allPartToZone = {}
	activeZonesTotalVolume = 0
	for zone, _ in pairs(registeredZones) do
		local isActive = activeZones[zone]
		if isActive then
			activeZonesTotalVolume += zone.volume
		end
		for _, zonePart in pairs(zone.groupParts) do
			if isActive then
				table.insert(activeParts, zonePart)
				activePartToZone[zonePart] = zone
			end
			table.insert(allParts, zonePart)
			allPartToZone[zonePart] = zone
		end
	end
end

function ZoneController._getZonesAndPlayers(zonesDictToCheck, zoneCustomVolume, onlyActiveZones, recommendedDetection)
	local totalZoneVolume = zoneCustomVolume
	if not totalZoneVolume then
		for zone, _ in pairs(zonesDictToCheck) do
			totalZoneVolume += zone.volume
		end
	end
	local zonesAndOccupants = {}
	if charactersTotalVolume < totalZoneVolume then
		-- If the volume of all *characters* within the server is *less than* the total
		-- volume of all active zones (i.e. zones which listen for .playerEntered)
		-- then it's more efficient cast regions and rays within each character and
		-- then determine the zones they belong to
		for _, plr in pairs(players:GetPlayers()) do
			local touchingZones = ZoneController.getTouchingZones(plr, onlyActiveZones, recommendedDetection)
			for _, zone in pairs(touchingZones) do
				if not onlyActiveZones or zone.activeTriggers["player"] then
					fillOccupants(zonesAndOccupants, zone, plr)
				end
			end
		end
	else
		-- If the volume of all *active zones* within the server is *less than* the total
		-- volume of all characters, then it's more efficient to perform the region and raycast
		-- checks directly within each zone to determine players inside
		for zone, _ in pairs(zonesDictToCheck) do
			if not onlyActiveZones or zone.activeTriggers["player"] then
				local result = workspace:FindPartsInRegion3WithWhiteList(zone.region, bodyParts, #bodyParts)
				local playersDict = {}
				for _, bodyPart in pairs(result) do
					local parentName = bodyPart.Parent.Name
					if not playersDict[parentName] then
						playersDict[parentName] = players:GetPlayerFromCharacter(bodyPart.Parent)
					end
				end
				for _, plr in pairs(playersDict) do
					if plr and zone:findPlayer(plr) then
						fillOccupants(zonesAndOccupants, zone, plr)
					end
				end
			end
		end
	end
	return zonesAndOccupants
end


Prompt: --!strict

Response:
local Array = script.Parent
local isArray = require(Array.isArray)
type Array<T> = { [number]: T }

return function(array: Array<any>, ...): number
	if _G.__DEV__ then
		if not isArray(array) then
			error(string.format("Array.unshift called on non-array %s", typeof(array)))
		end
	end

	local numberOfItems = select("#", ...)
	if numberOfItems > 0 then
		for i = numberOfItems, 1, -1 do
			local toInsert = select(i, ...)
			table.insert(array, 1, toInsert)
		end
	end

	return #array
end


Prompt: --[[Run]]

Response:
	--Print Version
	local ver=require(car["A-Chassis Tune"].README)
	print("//INSPARE: AC6 Loaded - Build "..ver)

	--Runtime Loops

	-- ~60 c/s
	game["Run Service"].Stepped:connect(function()
		--Steering
		Steering()

		--RPM
		RPM()

		--Update External Values
		_IsOn = car.DriveSeat.IsOn.Value
		_InControls = script.Parent.ControlsOpen.Value
		script.Parent.Values.Gear.Value = _CGear
		script.Parent.Values.RPM.Value = _RPM
		script.Parent.Values.Horsepower.Value = _HP
		script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
		script.Parent.Values.TransmissionMode.Value = _TMode
		script.Parent.Values.Throttle.Value = _GThrot
		script.Parent.Values.Brake.Value = _GBrake
		script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
		script.Parent.Values.SteerT.Value = _GSteerT
		script.Parent.Values.PBrake.Value = _PBrake
		script.Parent.Values.TCS.Value = _TCS
		script.Parent.Values.TCSActive.Value = _TCSActive
		script.Parent.Values.ABS.Value = _ABS
		script.Parent.Values.ABSActive.Value = _ABSActive
		script.Parent.Values.MouseSteerOn.Value = _MSteer
		script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity

		if car.DriveSeat.ABS.Value == true and car.DriveSeat.AS.Value == false then
			if car.DriveSeat.Velocity.Magnitude > 100 then
				if workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.12)*(10/12) * (60/88)))) then
					local p = workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.1)*(10/12) * (60/88))))
					local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
					if aa > 35 and (p.CanCollide or p.Parent.Name == "Body" or p.Parent.Parent.Name == "Body" or p.Parent.Name == "Wheels") and (p.Name ~= "Baseplate") then
						if (p.Velocity.Magnitude < 5 or p.Anchored) then
							car.DriveSeat.AS.Value = true
							_GBrake = 1
							repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
							car.DriveSeat.AS.Value = false
						end
					end
				end
			else
				if workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.05)*(10/12) * (60/88)))) then
					local p = workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.1)*(10/12) * (60/88))))
					local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
					if aa > 35 and (p.CanCollide or p.Parent.Name == "Body" or p.Parent.Parent.Name == "Body" or p.Parent.Name == "Wheels") and (p.Name ~= "Baseplate") then
						if (p.Velocity.Magnitude < 5 or p.Anchored) then
							car.DriveSeat.AS.Value = true
							_GBrake = 1
							repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
							car.DriveSeat.AS.Value = false
						end
					end
				end
			end

			if workspace:FindPartOnRay(Ray.new(snsrs.BMSL.RayEnd.CFrame.p,(snsrs.BMSL.RayEnd.CFrame.p-snsrs.BMSL.RayStart.CFrame.p).unit * 6)) and (_CGear == -1) then
				local p = workspace:FindPartOnRay(Ray.new(snsrs.BMSL.RayEnd.CFrame.p,(snsrs.BMSL.RayEnd.CFrame.p-snsrs.BMSL.RayStart.CFrame.p).unit * 6))
				local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
				if aa > 5 and (p.CanCollide) then
					if (p.Velocity.Magnitude < 5 or p.Anchored) then
						car.DriveSeat.AS.Value = true
						_GBrake = 1
						repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
						car.DriveSeat.AS.Value = false
					end
				end
			end

			if workspace:FindPartOnRay(Ray.new(snsrs.BMSR.RayEnd.CFrame.p,(snsrs.BMSR.RayEnd.CFrame.p-snsrs.BMSR.RayStart.CFrame.p).unit * 6)) and (_CGear == -1) then
				local p = workspace:FindPartOnRay(Ray.new(snsrs.BMSR.RayEnd.CFrame.p,(snsrs.BMSR.RayEnd.CFrame.p-snsrs.BMSR.RayStart.CFrame.p).unit * 6))
				local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
				if aa > 5 and (p.CanCollide) then
					if (p.Velocity.Magnitude < 5 or p.Anchored) then
						car.DriveSeat.AS.Value = true
						_GBrake = 1
						repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
						car.DriveSeat.AS.Value = false
					end
				end
			end

			if workspace:FindPartOnRay(Ray.new(snsrs.RS.RayEnd.CFrame.p,(snsrs.RS.RayEnd.CFrame.p-snsrs.RS.RayStart.CFrame.p).unit * 6)) and (_CGear == -1) then
				local p = workspace:FindPartOnRay(Ray.new(snsrs.RS.RayEnd.CFrame.p,(snsrs.RS.RayEnd.CFrame.p-snsrs.RS.RayStart.CFrame.p).unit * 6))
				local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
				if aa > 5 and (p.CanCollide) then
					if (p.Velocity.Magnitude < 5 or p.Anchored) then
						car.DriveSeat.AS.Value = true
						_GBrake = 1
						repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
						car.DriveSeat.AS.Value = false
					end
				end
			end
		end
	end)

	script.Parent.Values.Brake.Changed:connect(function()
		if math.ceil(_GBrake) > 0 then
        	car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', true)
		else
        	car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', false)
		end
	end)

	script.Parent.Values.Throttle.Changed:Connect(function()
		if math.ceil(_GThrot) > 0 then
			if car.DriveSeat.AS.Value == true then
				car.DriveSeat.AS.Value = false
				_GBrake = 0
			end
		end
	end)

	-- ~15 c/s
	while wait(.0667) do
		--Power
		Engine()

		--Flip
		if _Tune.AutoFlip then Flip() end
	end


Prompt: --fetching effectlib

Response:
local common_modules = game.ReplicatedStorage.CommonModules
EFFECT_LIB = require(common_modules.EffectLib)

local function GenColor(t, rate)
	local get_t = ((t - math.floor(t / rate) * rate) / rate) * math.pi * 2

	local red = math.sin(get_t + 0) * 0.5 + 0.5
	local green = math.sin(get_t + math.pi / 2) * 0.5 + 0.5
	local blue = math.sin(get_t + math.pi) * 0.5 + 0.5

	return Color3.new(red, green, blue)
end


Response:
local  Paint = false

script.Parent.MouseButton1Click:connect(function()
	Paint = not Paint
	handler:FireServer("Copper",Paint)
end)


Prompt:
--Rescripted by Luckymaxer
--Made by Stickmasterluke

Response:
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Sparkles = Handle:WaitForChild("Sparkles")

Players = game:GetService("Players")
Debris = game:GetService("Debris")

WeaponHud = Tool:WaitForChild("WeaponHud")
WeaponNameTag = WeaponHud:WaitForChild("WeaponName")
GuiBar = WeaponHud:WaitForChild("Bar")
GuiBarFill = GuiBar:WaitForChild("Fill")
WeaponNameTag.Text = Tool:WaitForChild("ToolName").Value

BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false

Animations = {
	Equip = {Animation = Tool:WaitForChild("Equip"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = nil},
	Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
	LeftSlash = {Animation = Tool:WaitForChild("LeftSlash"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
	RightSlash = {Animation = Tool:WaitForChild("RightSlash"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
	Stab1 = {Animation = Tool:WaitForChild("Stab1"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
	Stab2 = {Animation = Tool:WaitForChild("Stab2"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
}

Sounds = {
	Swoosh1 = Handle:WaitForChild("Swoosh1"),
	Swoosh2 = Handle:WaitForChild("Swoosh2"),
	Hit1 = Handle:WaitForChild("Hit1"),
	Hit2 = Handle:WaitForChild("Hit2"),
	Hit3 = Handle:WaitForChild("Hit3"),
	Clash1 = Handle:WaitForChild("Clash1"),
	Clash2 = Handle:WaitForChild("Clash2"),
	Clash3 = Handle:WaitForChild("Clash3"),
	Clash4 = Handle:WaitForChild("Clash4"),
	Clash5 = Handle:WaitForChild("Clash5"),
}

Damage = 22 -- +/- 10%
DamageWindow = 1 --How long the player has to hit opponent to deal damage after click
SwingRate = 0.75

BloodEffects = false

Ready = false
ToolEquipped = false
Rate = (1 / 30)
LastSwing = 0

MouseDown = false
CurrentAnimation = nil

ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool

ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool

Tool.Enabled = true

ServerControl.OnServerInvoke = (function(player, Mode, Value)
	if player == Player then
		if Mode == "MouseClick" then
			MouseDown = Value.Down
			if MouseDown then
				Activated()
			end
		elseif Mode == "KeyPress" then
			local Key = Value.Key
			local Down = Value.Down
		end
	end
end)

function InvokeClient(Mode, Value)
	local ClientReturn = nil
	pcall(function()
		ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
	end)
	return ClientReturn
end

function TagHumanoid(humanoid, player)
	local Creator_Tag = Instance.new("ObjectValue")
	Creator_Tag.Name = "creator"
	Creator_Tag.Value = player
	Debris:AddItem(Creator_Tag, 2)
	Creator_Tag.Parent = humanoid
end

function UntagHumanoid(humanoid)
	for i, v in pairs(humanoid:GetChildren()) do
		if v:IsA("ObjectValue") and v.Name == "creator" then
			v:Destroy()
		end
	end
end

function Billboard(Pos, Text, Time, Color)
	local Pos = (Pos or Vector3.new(0, 0, 0))
	local Text = (Text or "Hello World!")
	local Time = (Time or 2)
	local Color = (Color or Color3.new(1, 0, 0))
	local Pos = (Pos + Vector3.new(0, 5, 0))
	local EffectPart = BasePart:Clone()
	EffectPart.Name = "Effect"
	EffectPart.Size = Vector3.new(0, 0, 0)
	EffectPart.CFrame=CFrame.new(Pos)
	EffectPart.Anchored = true
	EffectPart.CanCollide = false
	EffectPart.Transparency = 1
	local BillboardGui = Instance.new("BillboardGui")
	BillboardGui.Size = UDim2.new(3, 0, 3, 0)
	BillboardGui.Adornee = EffectPart
	local TextLabel = Instance.new("TextLabel")
	TextLabel.BackgroundTransparency = 1
	TextLabel.Size = UDim2.new(1, 0, 1, 0)
	TextLabel.Text = Text
	TextLabel.TextColor3 = Color
	TextLabel.TextScaled = true
	TextLabel.Font = Enum.Font.ArialBold
	TextLabel.Parent = BillboardGui
	BillboardGui.Parent = EffectPart
	Debris:AddItem(EffectPart, (Time + 0.1))
	EffectPart.Parent = game:GetService("Workspace")
	Delay(0, function()
		local Frames = (Time / Rate)
		for Frame = 1, Frames do
			wait(Rate)
			local Percent = (Frame / Frames)
			EffectPart.CFrame=CFrame.new(Pos) + Vector3.new(0, (5 * Percent), 0)
			TextLabel.TextTransparency = Percent
		end
		if EffectPart and EffectPart.Parent then
			EffectPart:Destroy()
		end
	end)
end

function MakeBlood(Part)
	if not Part then
		return
	end
	local Blood = BasePart:Clone()
	Blood.BrickColor = BrickColor.new("Bright red")
	Blood.Transparency = (math.random(0, 1) * 0.5)
	Blood.CanCollide = ((math.random() < 0.5 and false) or true)
	Blood.Size = Vector3.new((0.2 * math.random(1, 5)), (0.2 * math.random(1, 5)), (0.2 * math.random(1, 5)))
	Blood.Velocity= Part.Velocity + (Vector3.new((math.random() - 0.5), (math.random() - 0.5), (math.random() - 0.5)) * 30)
	Blood.RotVelocity = Part.RotVelocity + (Vector3.new((math.random() - 0.5), (math.random() - 0.5), (math.random() - 0.5)) * 20)
	Blood.CFrame= Part.CFrame * CFrame.new(((math.random() - 0.5) * 3), ((math.random() - 0.5) * 3), ((math.random() - 0.5) * 3)) * CFrame.Angles((math.pi * 2 * math.random()), (math.pi * 2 * math.random()), (math.pi * 2 * math.random()))
	Debris:AddItem(Blood, (math.random() * 4))
	Blood.Parent = game:GetService("Workspace")
end

function Blow(Hit)
	if not Hit or not Hit.Parent or not CheckIfAlive() or not Ready or not ToolEquipped or (tick() - LastSwing) > DamageWindow then
		return
	end
	local character = Hit.Parent
	if character == Character then
		return
	end
	if Hit:FindFirstChild("CanBlock") and Handle:FindFirstChild("Blockable") then
		local Ready = false
		local PossibleSounds = {Sounds.Clash1, Sounds.Clash2, Sounds.Clash3, Sounds.Clash4, Sounds.Clash5}
		local Sound = PossibleSounds[math.random(1, #PossibleSounds)]
		Sound:Play()
		Sparkles.Enabled = true
		Delay(0.2, function()
			Sparkles.Enabled = false
		end)
		Billboard(Handle.Position, "Block", 2, Color3.new(1, 1, 0))
	end
	local humanoid = character:FindFirstChild("Humanoid")
	local player = Players:GetPlayerFromCharacter(character)
	local RightArm = Character:FindFirstChild("Right Arm")
	if humanoid and humanoid.Health > 0 and humanoid ~= Humanoid and RightArm then
		local RightGrip = RightArm:FindFirstChild("RightGrip")
		if RightGrip and (RightGrip.Part0 == Handle or RightGrip.Part1 == Handle) then
			if player and player ~= Player and not Player.Neutral and not player.Neutral and Player.TeamColor == player.TeamColor then
				return --No team killing
			end
			Ready = false
			UntagHumanoid(humanoid)
			TagHumanoid(humanoid)
			local LocalDamage= math.floor(Damage * (0.9 + (math.random() * 0.2)) + 0.5)
			humanoid:TakeDamage(LocalDamage)
			Billboard(Hit.Position, ("-" .. tostring(LocalDamage)))
			local PossibleSounds = {Sounds.Hit1, Sounds.Hit2, Sounds.Hit3}
			local Sound = PossibleSounds[math.random(1, #PossibleSounds)]
			Sound:Play()
			if BloodEffects then
				local NumBloodEffects = math.ceil(LocalDamage / 10)
				for i = 1, math.random((NumBloodEffects - 1), (NumBloodEffects + 1)) do
					MakeBlood(Hit)
				end
			end
		end
	end
end

function Activated()
	if ToolEquipped and (tick() - LastSwing) >= SwingRate then
		Tool.Enabled = false
		Ready = true

		local PossibleSounds = {Sounds.Swoosh1, Sounds.Swoosh2}
		local Sound = PossibleSounds[math.random(1, #PossibleSounds)]
		Sound:Play()

		local AttackAnimations = {Animations.LeftSlash, Animations.RightSlash, Animations.Stab1, Animations.Stab2}
		local NewAnimation = AttackAnimations[math.random(1, #AttackAnimations)]
		while NewAnimation == CurrentAnimation do
			NewAnimation = AttackAnimations[math.random(1, #AttackAnimations)]
		end

		CurrentAnimation = NewAnimation

		InvokeClient("PlayAnimation", CurrentAnimation)

		LastSwing = tick()

		wait(SwingRate)

		if MouseDown then
			Activated()
		end

		Tool.Enabled = true
	end
end

function UpdateGui()
	local SwingPercent = math.min(((tick() - LastSwing) / SwingRate), 1)
	if SwingPercent < 0.5 then	--fade from red to yellow then to green
		GuiBarFill.BackgroundColor3 = Color3.new(1, (SwingPercent * 2), 0)
	else
		GuiBarFill.BackgroundColor3 = Color3.new((1 - ((SwingPercent - 0.5 ) / 0.5)), 1, 0)
	end
	GuiBarFill.Size = UDim2.new(SwingPercent, 0, 1, 0)
end

function CheckIfAlive()
	return (Player and Player.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0)
end

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	PlayerGui = Player:FindFirstChild("PlayerGui")
	Humanoid = Character:FindFirstChild("Humanoid")
	if not CheckIfAlive() then
		return
	end
	if PlayerGui then
		WeaponHud.Parent = PlayerGui
	end
	InvokeClient("PlayAnimation", Animations.Equip)
	LastSwing = tick()
	Ready = false
	ToolEquipped = true
	for i, v in pairs(Animations) do
		if v and v.Animation then
			InvokeClient("Preload", v.Animation.AnimationId)
		end
	end
	ToolEquipped = true
end

function Unequipped()
	for i, v in pairs(Animations) do
		InvokeClient("StopAnimation", v)
	end
	WeaponHud.Parent = Tool
	ToolEquipped = false
	Ready = false
end

Handle.Touched:connect(Blow)

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)

Spawn(function()
	while true do
		UpdateGui()
		wait(Rate)
	end
end)


Response:
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 = 305
				lwd.MaxSpeed = 305
				rrwd.MaxSpeed = 305
                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()