fly script
Key RequiredUniversal

fly script

Universal Scriptpjvhubpjvhub 822 views 294 executesUpdated Jan 21, 2026
Unrated
00
Lua Script•150 lines (4434 chars)
--// Services
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

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

--// Fly variables
local flying = false
local speed = 60
local bv, bg
local control = {F=0,B=0,L=0,R=0,U=0,D=0}

--// UI
local gui = Instance.new("ScreenGui", player.PlayerGui)
gui.Name = "FlyUI"
gui.ResetOnSpawn = false

local main = Instance.new("Frame", gui)
main.Size = UDim2.fromScale(0.22, 0.22)
main.Position = UDim2.fromScale(0.05, 0.35)
main.BackgroundColor3 = Color3.fromRGB(15,15,25)
main.BorderSizePixel = 0
main.Active = true
main.Draggable = true
main.Name = "Main"

Instance.new("UICorner", main).CornerRadius = UDim.new(0,14)

local glow = Instance.new("UIStroke", main)
glow.Color = Color3.fromRGB(0,170,255)
glow.Thickness = 2

local title = Instance.new("TextLabel", main)
title.Size = UDim2.fromScale(1,0.25)
title.BackgroundTransparency = 1
title.Text = "FLY MODULE"
title.TextColor3 = Color3.fromRGB(0,200,255)
title.Font = Enum.Font.GothamBold
title.TextScaled = true

local toggle = Instance.new("TextButton", main)
toggle.Position = UDim2.fromScale(0.1,0.35)
toggle.Size = UDim2.fromScale(0.8,0.25)
toggle.Text = "FLY : OFF"
toggle.Font = Enum.Font.GothamBold
toggle.TextScaled = true
toggle.BackgroundColor3 = Color3.fromRGB(30,30,45)
toggle.TextColor3 = Color3.fromRGB(255,80,80)
Instance.new("UICorner", toggle)

local minimize = Instance.new("TextButton", main)
minimize.Position = UDim2.fromScale(0.1,0.7)
minimize.Size = UDim2.fromScale(0.8,0.2)
minimize.Text = "MINIMIZE"
minimize.Font = Enum.Font.Gotham
minimize.TextScaled = true
minimize.BackgroundColor3 = Color3.fromRGB(20,20,35)
minimize.TextColor3 = Color3.fromRGB(200,200,200)
Instance.new("UICorner", minimize)

--// Minimized button
local miniBtn = Instance.new("TextButton", gui)
miniBtn.Size = UDim2.fromScale(0.1,0.07)
miniBtn.Position = UDim2.fromScale(0.05,0.35)
miniBtn.Text = "FLY"
miniBtn.Visible = false
miniBtn.Font = Enum.Font.GothamBold
miniBtn.TextScaled = true
miniBtn.BackgroundColor3 = Color3.fromRGB(15,15,25)
miniBtn.TextColor3 = Color3.fromRGB(0,200,255)
Instance.new("UICorner", miniBtn)
Instance.new("UIStroke", miniBtn).Color = Color3.fromRGB(0,170,255)

--// Fly functions
local function startFly()
	flying = true
	humanoid.PlatformStand = true

	bv = Instance.new("BodyVelocity", root)
	bv.MaxForce = Vector3.new(9e9,9e9,9e9)

	bg = Instance.new("BodyGyro", root)
	bg.MaxTorque = Vector3.new(9e9,9e9,9e9)
	bg.P = 9e4
end

local function stopFly()
	flying = false
	humanoid.PlatformStand = false
	if bv then bv:Destroy() end
	if bg then bg:Destroy() end
end

--// Controls
UIS.InputBegan:Connect(function(i,gp)
	if gp then return end
	if i.KeyCode == Enum.KeyCode.W then control.F = 1 end
	if i.KeyCode == Enum.KeyCode.S then control.B = -1 end
	if i.KeyCode == Enum.KeyCode.A then control.L = -1 end
	if i.KeyCode == Enum.KeyCode.D then control.R = 1 end
	if i.KeyCode == Enum.KeyCode.Space then control.U = 1 end
	if i.KeyCode == Enum.KeyCode.LeftShift then control.D = -1 end
end)

UIS.InputEnded:Connect(function(i)
	if i.KeyCode == Enum.KeyCode.W then control.F = 0 end
	if i.KeyCode == Enum.KeyCode.S then control.B = 0 end
	if i.KeyCode == Enum.KeyCode.A then control.L = 0 end
	if i.KeyCode == Enum.KeyCode.D then control.R = 0 end
	if i.KeyCode == Enum.KeyCode.Space then control.U = 0 end
	if i.KeyCode == Enum.KeyCode.LeftShift then control.D = 0 end
end)

RunService.RenderStepped:Connect(function()
	if flying and bv and bg then
		local cam = workspace.CurrentCamera
		bg.CFrame = cam.CFrame
		bv.Velocity =
			(cam.CFrame.LookVector * (control.F + control.B) +
			cam.CFrame.RightVector * (control.R + control.L) +
			Vector3.new(0, control.U + control.D, 0)) * speed
	end
end)

--// Buttons
toggle.MouseButton1Click:Connect(function()
	if flying then
		stopFly()
		toggle.Text = "FLY : OFF"
		toggle.TextColor3 = Color3.fromRGB(255,80,80)
	else
		startFly()
		toggle.Text = "FLY : ON"
		toggle.TextColor3 = Color3.fromRGB(80,255,120)
	end
end)

minimize.MouseButton1Click:Connect(function()
	main.Visible = false
	miniBtn.Visible = true
end)

miniBtn.MouseButton1Click:Connect(function()
	main.Visible = true
	miniBtn.Visible = false
end)

Features & Information

fly script toggel ui

Community Comments (3)

pjvhubpjvhubJan 21, 2026

pls comment your thouts

Jndl102Jndl102Jan 21, 2026

Win

Locomk1Locomk1Jan 21, 2026

Chatgpt

More Scripts for Universal Scripts