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

if UserInputService.TouchEnabled then
	local MobileButtons = plr.PlayerGui.MobileButtons:WaitForChild("MobileButtons")
	MobileButtons.Visible = true

	local MobileBlockButton = MobileButtons.Block

	MobileBlockButton.Activated:Connect(function()
		if not char.Values:FindFirstChild("Stunned") and not debounce then
			if Status == "nil" then
				startBlocking()
			else
				stopBlocking()
			end
		end
	end)
end
-- Renderers that don't support test selectors
-- can re-export everything from this module.

local function shim(...)
	invariant(
		false,
		"The current renderer does not support test selectors. "
			.. "This error is likely caused by a bug in React. "
			.. "Please file an issue."
	)
end
-- Thourough check to see if a character is sitting
local function amISitting(character)
	return character.Humanoid.SeatPart ~= nil
end
--[[
	Constructs a new computed state object, which follows the value of another
	state object using a spring simulation.
]]

local Package = script.Parent.Parent
local logError = require(Package.Logging.logError)
local unpackType = require(Package.Animation.unpackType)
local SpringScheduler = require(Package.Animation.SpringScheduler)
local useDependency = require(Package.Dependencies.useDependency)
local initDependency = require(Package.Dependencies.initDependency)
local updateAll = require(Package.Dependencies.updateAll)

local class = {}

local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}

local ENABLE_PARAM_SETTERS = false
-- / Configuration / --
local Configurations = GameAssets.Configurations
local DefaultMapConfiguration = Configurations.DefaultMapConfiguration
-- declarations

local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Humanoid")
local pose = "Standing"

local toolAnim = "None"
local toolAnimTime = 0

local jumpMaxLimbVelocity = 0.75
-- Gradually regenerates the Humanoid's Health over time.

local REGEN_RATE = 1/2000 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 1 -- Wait this long between each regeneration step.
--//ENGINE//--
Horsepower = 170  --{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 = "Natural" --{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 = 100 --{Limits top speed of the vehicle [In MPH]}
-- Touching this Battle Armor doubles you MaxHealth and heals you to full power

local debounce = false

function getPlayer(humanoid)
	-- find the owning player of a humanoid.
	local players = game.Players:children()
	for i = 1, #players do
		if players[i].Character ~= nil then
			if players[i].Character.Humanoid == humanoid then return players[i] end
		end
	end
	return nil
end


function putOnArmor(humanoid)

	local torso = humanoid.Parent.Torso

	torso.Reflectance = .6
	humanoid.MaxHealth = 200
	
	
	local player = getPlayer(humanoid)
	if player ~= nil then
		local message = Instance.new("Message")
		message.Text = "You found Battle Armor!"
		message.Parent = player
		wait(5)
		message.Text = "Max Health Doubled!"
		wait(5)
		message.Parent = nil
	end


end

function hasArmor(humanoid)
	return (humanoid.MaxHealth > 100)
end

function onTouched(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	if humanoid~=nil and debounce == false then
		if (hasArmor(humanoid)) then return end
		debounce = true
		script.Parent.Parent = nil
		putOnArmor(humanoid)
		debounce = false
	end
end


script.Parent.Touched:connect(onTouched)
-- / REs / --
local PlayerEvent = game.ReplicatedStorage:WaitForChild(Character.Name)
--This only works under StarterGui, The main code is located under the local script.
script.Chat.Disabled = false
script.PlayerSent.OnServerEvent:Connect(function(player,msg)
	print(player,msg)
	--code when received command
end)
--[[
	Generates symbols used to denote property change handlers when working with
	the `New` function.
]]

local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)

local function OnChange(propertyName: string): PubTypes.OnChangeKey
	return {
		type = "Symbol",
		name = "OnChange",
		key = propertyName
	}
end

return OnChange
--Move this script to Workspace.

function onPlayerEntered(player)
player.Chatted:connect(function(msg)
if msg == "!REJOIN" then
	game:GetService("TeleportService"):Teleport(game.PlaceId, player)
	if player.Character ~= nil then
		player.Character:remove()
	end
end
end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)
--[=[
	Registers a callback that runs when an unhandled rejection happens. An unhandled rejection happens when a Promise
	is rejected, and the rejection is not observed with `:catch`.

	The callback is called with the actual promise that rejected, followed by the rejection values.

	@since v3.2.0
	@param callback (promise: Promise, ...: any) -- A callback that runs when an unhandled rejection happens.
	@return () -> () -- Function that unregisters the `callback` when called
]=]
function Promise.onUnhandledRejection(callback)
	table.insert(Promise._unhandledRejectionCallbacks, callback)

	return function()
		local index = table.find(Promise._unhandledRejectionCallbacks, callback)

		if index then
			table.remove(Promise._unhandledRejectionCallbacks, index)
		end
	end
end

return Promise
--	g.MaxTorque=Vector3.new(math.abs(carSeat.CFrame.lookVector.X),math.abs(carSeat.CFrame.lookVector.Y*1),math.abs(carSeat.CFrame.lookVector.Z))*600

	if ks.CanCollide == true then
		carSeat.Parent.Body.KW.swag.BodyThrust.force = Vector3.new(0,-50,0)
	else
		carSeat.Parent.Body.KW.swag.BodyThrust.force = Vector3.new(0,0,0)
	end
	if carSeat.Throttle == 1 and Burnout == 1 then
		wheel2.Smoke.Enabled = true
		wheel2.Smoke.Opacity = (speedw/50)
		wheel2.Smoke.RiseVelocity = (speedw/100)
	else
		wheel2.Smoke.Enabled = false
	end
	if carSeat.Throttle == -1 then
		carSeat.Parent.Body.Lights.Brake.Material = "Neon"
		carSeat.Parent.Body.Lights.Brake.BrickColor = BrickColor.new("Really red")
	else
		carSeat.Parent.Body.Lights.Brake.Material = "SmoothPlastic"
		carSeat.Parent.Body.Lights.Brake.BrickColor = BrickColor.new("Pearl")
	end
end
--[[ FUNCTIONS ]]--

Players.PlayerAdded:connect(function(player) -- player Joins Game
	if player.MembershipType == Enum.MembershipType.Premium then -- if they are premium
		
		--[[ EXTRA PLAYER LEADERSTATS]]--
		
		local AddedGems = 15 -- how many points to add

		player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + AddedGems -- adding The Points everytime they join the game
		
		-- || CHANGE NAME HERE ^^^^^					AND CHANGE ^^ IF ITS DIFFERENT || --

		--[[ EXTRA PLAYER GEAR ]]--

		local starterGear = player:WaitForChild("StarterGear") -- starter gear
		local specialTool = ServerStorage:FindFirstChild("Tool"):Clone() -- getting special tool
		
		specialTool.Parent = starterGear -- setting parent to starter gear
		
		--[[ EXTRA HEALTH/SUPER POWERS (COMMENT OUT IF YOU DON'T WANT IT) ]] --
		
		player.CharacterAdded:connect(function(char)
			local humanoid = char:findFirstChild("Humanoid")

			if humanoid then
				humanoid.MaxHealth = 300
				humanoid.Health = humanoid.MaxHealth
				humanoid.WalksSpeed = 100
				humanoid.JumpPower = 250
			end
			
		end)
		
	end
end)
--[[
userInput.TouchLongPress:Connect(function(touchPositions, state, processed)
	if (processed or state ~= Enum.UserInputState.Begin) then return end
	Mobile.SwitchView = true
end)
]]


return Mobile
-- options -------------------------

setupmode = "Manual" -- Manual or Auto (if you want to pick what plugins you have yourself or you want it to be automated)
soundplugin = "SoundSuite"	-- StockSound, SoundSuite or 1.5 Sound (no others are supported, sorry!) (MANUAL ONLY)
camkey = "v" -- the key you use for first person camera
level = 50 -- 0% - 100% 
exceptions = {"Pedal","Shift"} -- put names of audios to ignore here (AUTO ONLY)
--[=[
	@param name string
	@param inboundMiddleware ClientMiddleware?
	@param outboundMiddleware ClientMiddleware?
	@return ClientRemoteSignal
	Returns a new ClientRemoteSignal that mirrors the matching RemoteSignal created by
	ServerComm with the same matching `name`.
]=]
function ClientComm:GetSignal(name: string, inboundMiddleware: ClientMiddleware?, outboundMiddleware: ClientMiddleware?)
	return Comm.Client.GetSignal(self._instancesFolder, name, inboundMiddleware, outboundMiddleware)
end
--[[ END OF SERVICES ]]

local LocalPlayer = PlayersService.LocalPlayer
while LocalPlayer == nil do
	PlayersService.ChildAdded:wait()
	LocalPlayer = PlayersService.LocalPlayer
end

local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

local okShouldClipInGameChat, valueShouldClipInGameChat = pcall(function() return UserSettings():IsUserFeatureEnabled("UserShouldClipInGameChat") end)
local shouldClipInGameChat = okShouldClipInGameChat and valueShouldClipInGameChat
--////////////////////////////// Include
--//////////////////////////////////////
local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local moduleChannelsTab = require(modulesFolder:WaitForChild("ChannelsTab"))
local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))
--Set up event for when the server is shutting down.
StartShutdown.OnClientEvent:Connect(function()
	--Create the Gui and have it semi-transparent for 1 second.
	local Gui,Background = CreateTeleportScreen()
	Background.BackgroundTransparency = 0.5
	Gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
	wait(1)
	
	--Tween the transparency to 0.
	local Start = tick()
	local Time = 0.5
	while tick() - Start < Time do
		local Dif = tick() - Start
		local Ratio = Dif/Time
		Background.BackgroundTransparency = 0.5 * (1 - Ratio)
		RenderStepped:Wait()
	end
	Background.BackgroundTransparency = 0
end)
--[=[
	Constructs a new Signal that wraps around an RBXScriptSignal.

	@param rbxScriptSignal RBXScriptSignal -- Existing RBXScriptSignal to wrap
	@return Signal

	For example:
	```lua
	local signal = Signal.Wrap(workspace.ChildAdded)
	signal:Connect(function(part) print(part.Name .. " added") end)
	Instance.new("Part").Parent = workspace
	```
]=]
function Signal.Wrap<T...>(rbxScriptSignal: RBXScriptSignal): Signal<T...>
	assert(
		typeof(rbxScriptSignal) == "RBXScriptSignal",
		"Argument #1 to Signal.Wrap must be a RBXScriptSignal; got " .. typeof(rbxScriptSignal)
	)
	local signal = Signal.new()
	signal._proxyHandler = rbxScriptSignal:Connect(function(...)
		signal:Fire(...)
	end)
	return signal
end
--health.Changed:connect(function()
--root.Velocity = Vector3.new(0,5000,0)
--end)

local anims = {}
local lastAttack= tick()

local target,targetType

local lastLock = tick()

local fleshDamage = 50
local structureDamage = 100

local path = nil


for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end

function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()

if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))

elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end

rep.Events.NPCAttack:Fire(thing,dmg) 
end
end


function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end

function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end
--Positions
local xpos = script.Parent.Position.X
local ypos = script.Parent.Position.Y
local zpos = script.Parent.Position.Z

local size = Vector3.new(xsize, ysize, zsize)
local newsize = Vector3.new(xsize + 0.1, ysize + 0.1, zsize + 0.1)

while true do
	script.Parent.Size = newsize
	script.Parent.Position = Vector3.new(xpos,ypos + 0.05,zpos)
	wait(0.2)
	script.Parent.Size = size
	script.Parent.Position = Vector3.new(xpos,ypos,zpos)
	wait(0.2)
end
--[=[
	@param instance Instance
	@return RBXScriptConnection
	Attaches the Janitor to a Roblox instance. Once this
	instance is removed from the game (parent or ancestor's
	parent set to `nil`), the Janitor will automatically
	clean up.

	:::caution
	Will throw an error if `instance` is not a descendant
	of the game hierarchy.
	:::
]=]
function Janitor:AttachToInstance(instance: Instance)
	assert(instance:IsDescendantOf(game), "Instance is not a descendant of the game hierarchy")
	return self:Connect(instance.AncestryChanged, function(_child, parent)
		if not parent then
			self:Destroy()
		end
	end)
end
--		if rot>-math.pi/8 then
--			rot=rot-math.pi/20
--		end
		spd.velocity=chg+(engine.CFrame.lookVector-Vector3.new(0.5,0,0))*inc
		--gyro.cframe=mouse.Hit
		--gyro.cframe=gyro.cframe*CFrame.Angles(0,-math.pi/5,rot)
	else
		rot=0
	end
	
	
end
--Scripted by DermonDarble

local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local horse = script:WaitForChild("Horse").Value

local horseGui = script:WaitForChild("HorseGui")
horseGui.Parent = player.PlayerGui

humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)

local rideAnimation = humanoid:LoadAnimation(horse.Animations.Ride)
rideAnimation:Play()

local movement = Vector3.new(0, 0, 0)

userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
	if not gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
			movement = Vector3.new(movement.X, movement.Y, -1)
		elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
			movement = Vector3.new(movement.X, movement.Y, 1)
		elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
			movement = Vector3.new(-1, movement.Y, movement.Z)
		elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
			movement = Vector3.new(1, movement.Y, movement.Z)
		elseif inputObject.KeyCode == Enum.KeyCode.Space then
			local ray = Ray.new(horse.HumanoidRootPart.Position + Vector3.new(0, -4.3, 0), Vector3.new(0, -1, 0))
			local hit, position = game.Workspace:FindPartOnRay(ray, horse)
			if hit and hit.CanCollide then
				horse.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.LeftShift then
			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		end
	end
end)

userInputService.InputEnded:connect(function(inputObject, gameProcessedEvent)
	if not gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
			if movement.Z < 0 then
				movement = Vector3.new(movement.X, movement.Y, 0)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
			if movement.Z > 0 then
				movement = Vector3.new(movement.X, movement.Y, 0)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
			if movement.X < 0 then
				movement = Vector3.new(0, movement.Y, movement.Z)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
			if movement.X > 0 then
				movement = Vector3.new(0, movement.Y, movement.Z)
			end
		end
	end
end)

spawn(function()
	while horse.Seat.Occupant == humanoid do
		game:GetService("RunService").RenderStepped:wait()
		horse.Humanoid:Move(movement, true)
	end
	horseGui:Destroy()
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
	horse.Humanoid:Move(Vector3.new())
	rideAnimation:Stop()
	script:Destroy()
end)
-- setup emote chat hook (not nessessary)
--[[game.Players.LocalPlayer.Chatted:connect(function(msg)
	local emote = ""
	if msg == "/e dance" then
		emote = dances[math.random(1, #dances)]
	elseif (string.sub(msg, 1, 3) == "/e ") then
		emote = string.sub(msg, 4)
	elseif (string.sub(msg, 1, 7) == "/emote ") then
		emote = string.sub(msg, 8)
	end
	
	if (pose == "Standing" and emoteNames[emote] ~= nil) then
		playAnimation(emote, 0.1, Humanoid)
	end

end)]]--
---------------------------------------------------

Displays = 3 -- Sets how many displays this scripts will use...
DisplayColor = Color3.fromRGB(33, 84, 185)
UColor = Color3.fromRGB(33, 84, 185)
DColor = Color3.fromRGB(33, 84, 185)
ArrowDelay = 0.05
-----------------
--| Functions |--
-----------------

local function OnActivated()
	local myModel = MyPlayer.Character
	if Tool.Enabled and myModel and myModel:FindFirstChildOfClass("Humanoid") and myModel.Humanoid.Health > 0 then
		Tool.Enabled = false
		script.Parent.Handle.FireSound:Play()
		local Pos = MouseLoc:InvokeClient(MyPlayer)
		-- Create a clone of Rocket and set its color
		local rocketClone = Rocket:Clone()
		DebrisService:AddItem(rocketClone, 30)
		rocketClone.BrickColor = MyPlayer.TeamColor

		-- Position the rocket clone and launch!
		local spawnPosition = (ToolHandle.CFrame * CFrame.new(5, 0, 0)).p
		rocketClone.CFrame = CFrame.new(spawnPosition, Pos) --NOTE: This must be done before assigning Parent
		rocketClone.Velocity = rocketClone.CFrame.lookVector * ROCKET_SPEED --NOTE: This should be done before assigning Parent
		rocketClone.Parent = workspace
		rocketClone:SetNetworkOwner(nil)

		wait(RELOAD_TIME)

		Tool.Enabled = true
		script.Parent.Handle.Ready:Play()
	end
end

function OnEquipped()
	MyPlayer = PlayersService:GetPlayerFromCharacter(Tool.Parent)
end
--[[ Settings Changed Connections ]]--
LocalPlayer.Changed:connect(function(property)
	if lastInputType == Enum.UserInputType.Touch and property == 'DevTouchMovementMode' then
		ControlState:SwitchTo(ControlModules.Touch)
	elseif UserInputService.KeyboardEnabled and property == 'DevComputerMovementMode' then
		ControlState:SwitchTo(ControlModules.Keyboard)
	end
end)

GameSettings.Changed:connect(function(property)
	if not IsUserChoice then return end
	if property == 'TouchMovementMode' or property == 'ComputerMovementMode' then
		UserMovementMode = GameSettings[property]
		if property == 'ComputerMovementMode' then
			ControlState:SwitchTo(ControlModules.Keyboard)
		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, -1, 0)) end)
backForceField.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 1, 0)) end)

vehicle.Wheel_BackLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
vehicle.Wheel_FrontLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
vehicle.Wheel_BackRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
vehicle.Wheel_FrontRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) 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)
--- FUNCTIONS ---

local isFreecam = false
local MouseListening = false
Freecam = function()
	UserInputService.MouseIconEnabled = not UserInputService.MouseIconEnabled

	if not isFreecam then
		isFreecam = not isFreecam

		Camera.CameraType = "Scriptable"
		-- When mouse button 1 is held down go move camera forward in direction its facing, go backwards with mouse button 2
		MouseListening = true
		while MouseListening do
			task.wait()

			local MouseInstancePos = Mouse.Hit.Position
			-- Look at MouseInstancePos
			local Final = CFrame.new(Camera.CFrame.Position, MouseInstancePos)

			local DownButtons = UserInputService:GetMouseButtonsPressed()
			if #DownButtons ~= 0 then
				if DownButtons[1].UserInputType == Enum.UserInputType.MouseButton1 then
					Final *= CFrame.new(0, 0, -5)
				elseif DownButtons[1].UserInputType == Enum.UserInputType.MouseButton2 then
					Final *= CFrame.new(0, 0, 5)
				end
			end

			TweenService:Create(Camera, TweenInfo.new(0.25), {CFrame = Final}):Play()
		end
	else
		isFreecam = not isFreecam
		MouseListening = false
		Player.Character.HumanoidRootPart.CFrame = Camera.CFrame
		Camera.CameraType = "Custom"
	end
end

ShiftLockToggle = function()

	Locked = not Locked

	-- Fix HRP to the camera direction
	local HumanoidRootPart = Player.Character.HumanoidRootPart
	local previousAngle = 0
	while Locked do
		task.wait()
		local cameraForward = Camera.CFrame.LookVector
		cameraForward = Vector3.new(cameraForward.x, 0, cameraForward.z).Unit

		local angle = math.atan2(-cameraForward.x, -cameraForward.z)
		HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position) * CFrame.Angles(0, angle, 0)
	end

end

Run = function(Humanoid, KeyCode)
	Humanoid.WalkSpeed = 23.5

	local RunAnimation = Humanoid:LoadAnimation(script.Run)
	RunAnimation:Play()

	if not isMobile then
		repeat task.wait() until not UserInputService:IsKeyDown(KeyCode)
	else
		UserInputService.InputEnded:Wait()
	end
	Humanoid.WalkSpeed = 16

	RunAnimation:Stop()
	RunAnimation:Remove()
end

Input = function(Input, Typing)
	if Typing then return end

	repeat task.wait() until Player.Character
	local Character = Player.Character
	local Humanoid = Character:WaitForChild("Humanoid")

	local KeyCode = Input.KeyCode

	if table.find(DirectionalKeys, KeyCode) then

		if (tick() - LastDirectional < 0.2) and LastKeyDown == KeyCode then
			Run(Humanoid, KeyCode)
		end

		LastDirectional = tick()
	end

	LastKeyDown = KeyCode

end