Fly script v56
Key RequiredUniversal

Fly script v56

Universal Scriptfara2mjtfara2mjt 10.6K views 31 executesUpdated Jul 15, 2025
Unrated
00
Lua Script•79 lines (2303 chars)
-- LocalScript (put in StarterPlayerScripts)

local Players      = game:GetService("Players")
local RunService   = game:GetService("RunService")
local UIS          = game:GetService("UserInputService")

local player       = Players.LocalPlayer
local character    = player.Character or player.CharacterAdded:Wait()
local hrp          = character:WaitForChild("HumanoidRootPart")
local hum          = character:WaitForChild("Humanoid")

-- UI button
local gui   = Instance.new("ScreenGui")
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")

local button = Instance.new("TextButton")
button.Size       = UDim2.new(0,120,0,40)
button.Position   = UDim2.new(0,10,0.8,0)
button.Text       = "Enable"
button.BackgroundTransparency = 0.25
button.Parent     = gui

-- flight helpers
local flying = false
local speed  = 80

local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(1e5,1e5,1e5)
bv.P        = 1e4
bv.Velocity = Vector3.zero
bv.Enabled  = false
bv.Parent   = hrp

local bg = Instance.new("BodyGyro")
bg.MaxTorque = Vector3.new(1e5,1e5,1e5)
bg.P         = 1e4
bg.CFrame    = hrp.CFrame
bg.Enabled   = false
bg.Parent    = hrp

local function setCollide(state)
	for _,p in ipairs(character:GetDescendants()) do
		if p:IsA("BasePart") then p.CanCollide = state end
	end
end

local dir = Vector3.zero
local function updateDir()
	dir = Vector3.zero
	if UIS:IsKeyDown(Enum.KeyCode.W) then dir += hrp.CFrame.LookVector end
	if UIS:IsKeyDown(Enum.KeyCode.S) then dir -= hrp.CFrame.LookVector end
	if UIS:IsKeyDown(Enum.KeyCode.A) then dir -= hrp.CFrame.RightVector end
	if UIS:IsKeyDown(Enum.KeyCode.D) then dir += hrp.CFrame.RightVector end
	if UIS:IsKeyDown(Enum.KeyCode.Space) then dir += Vector3.new(0,1,0) end
	if UIS:IsKeyDown(Enum.KeyCode.LeftControl) then dir -= Vector3.new(0,1,0) end
	if dir.Magnitude > 0 then
		dir = dir.Unit * speed
	end
end

RunService.RenderStepped:Connect(function()
	if flying then
		updateDir()
		bv.Velocity = dir
		bg.CFrame   = workspace.CurrentCamera.CFrame
	end
end)

local function toggleFly()
	flying            = not flying
	button.Text       = flying and "Disable" or "Enable"
	bv.Enabled        = flying
	bg.Enabled        = flying
	setCollide(not flying)
	hum.PlatformStand = flying
end

button.MouseButton1Click:Connect(toggleFly)

Features & Information

Fly through walls

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts