-- Fly script -- Z to toggle -- E/Q to fly up/down -- R/F to increase/decrease speed -- Script by: JigglingCheeks local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local localplayer = Players.LocalPlayer local enabled = false local speed = 2 local minSpeed = 1 local maxSpeed = 200 local dir = {w = 0, s = 0, a = 0, d = 0, up = 0, down = 0} local character, hum, hrp local connections = {} local dead = false local currentRunId = 0 local function disconnectAll() for _, c in ipairs(connections) do if c then c:Disconnect() end end table.clear(connections) end local function getCharacterParts() character = localplayer.Character if not character then return false end hum = character:FindFirstChildOfClass("Humanoid") hrp = character:FindFirstChild("HumanoidRootPart") return hum ~= nil and hrp ~= nil end local function stopFly() enabled = false if hrp then hrp.AssemblyLinearVelocity = Vector3.zero end if hum then hum.PlatformStand = false end if hrp then hrp.Anchored = false end end local function setFly(state) if dead then return end enabled = state and true or false if enabled then if not getCharacterParts() then enabled = false return end hrp.Anchored = true hum.PlatformStand = true else stopFly() end end local function bindCharacter(char) currentRunId += 1 local runId = currentRunId disconnectAll() stopFly() character = char hum = char:WaitForChild("Humanoid") hrp = char:WaitForChild("HumanoidRootPart") dead = false table.insert(connections, hum.Died:Connect(function() dead = true stopFly() disconnectAll() end)) table.insert(connections, UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed or dead then return end local key = input.KeyCode if key == Enum.KeyCode.W then dir.w = 1 elseif key == Enum.KeyCode.S then dir.s = 1 elseif key == Enum.KeyCode.A then dir.a = 1 elseif key == Enum.KeyCode.D then dir.d = 1 elseif key == Enum.KeyCode.E then dir.up = 1 elseif key == Enum.KeyCode.Q then dir.down = 1 elseif key == Enum.KeyCode.R then speed = math.clamp(speed + 1, minSpeed, maxSpeed) elseif key == Enum.KeyCode.F then speed = minSpeed elseif key == Enum.KeyCode.Z then setFly(not enabled) end end)) table.insert(connections, UserInputService.InputEnded:Connect(function(input, gameProcessed) if gameProcessed or dead then return end local key = input.KeyCode if key == Enum.KeyCode.W then dir.w = 0 elseif key == Enum.KeyCode.S then dir.s = 0 elseif key == Enum.KeyCode.A then dir.a = 0 elseif key == Enum.KeyCode.D then dir.d = 0 elseif key == Enum.KeyCode.E then dir.up = 0 elseif key == Enum.KeyCode.Q then dir.down = 0 end end)) table.insert(connections, RunService.RenderStepped:Connect(function() if runId ~= currentRunId then return end if dead or not enabled then return end if not character or not character.Parent or not hum or not hrp or not hrp.Parent or hum.Health <= 0 then setFly(false) return end local cam = workspace.CurrentCamera if not cam then return end local moveVec = (cam.CFrame.LookVector * (dir.w - dir.s)) + (cam.CFrame.RightVector * (dir.d - dir.a)) + (Vector3.new(0, 1, 0) * (dir.up - dir.down)) if moveVec.Magnitude > 0 then moveVec = moveVec.Unit end local nextPos = hrp.Position + (moveVec * speed) hrp.CFrame = CFrame.new(nextPos, nextPos + cam.CFrame.LookVector) if hrp.AssemblyLinearVelocity.Magnitude > 0 then hrp.AssemblyLinearVelocity = Vector3.zero end end)) end if localplayer.Character then bindCharacter(localplayer.Character) end localplayer.CharacterAdded:Connect(function(char) bindCharacter(char) end)