Fly davilucas123jc
Key RequiredUniversal

Fly davilucas123jc

Universal Scriptdavilucasjunqueiracdavilucasjunqueirac 684 views 2 executesUpdated Aug 2, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•102 lines (2894 chars)
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()

local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
screenGui.ResetOnSpawn = false
screenGui.Name = "FlyGui"

local function createButton(name, position, size, text, parent)
	local btn = Instance.new("TextButton")
	btn.Name = name
	btn.Size = size
	btn.Position = position
	btn.Text = text
	btn.Parent = parent
	btn.BackgroundColor3 = Color3.new(1, 1, 1)
	btn.BorderColor3 = Color3.new(0, 0, 0)
	btn.TextColor3 = Color3.new(0, 0, 0)
	btn.TextScaled = true
	btn.AutoButtonColor = true
	return btn
end

local flyButton = createButton("FlyButton", UDim2.new(0.5, -50, 0.5, -25), UDim2.new(0, 100, 0, 50), "Fly", screenGui)
flyButton.Active = true
flyButton.Draggable = true

local arrowSize = UDim2.new(0, 60, 0, 60)
local arrowGui = Instance.new("Frame", screenGui)
arrowGui.Size = UDim2.new(0, 200, 0, 200)
arrowGui.Position = UDim2.new(1, -220, 1, -220)
arrowGui.BackgroundTransparency = 1

local directions = {
	Up = {pos = UDim2.new(0.5, -30, 0, 0), symbol = "↑"},
	Down = {pos = UDim2.new(0.5, -30, 1, -60), symbol = "↓"},
	Left = {pos = UDim2.new(0, 0, 0.5, -30), symbol = "←"},
	Right = {pos = UDim2.new(1, -60, 0.5, -30), symbol = "→"},
}

local moveInput = {
	Up = false,
	Down = false,
	Left = false,
	Right = false
}

for dir, info in pairs(directions) do
	local btn = createButton(dir.."Arrow", info.pos, arrowSize, info.symbol, arrowGui)
	btn.BackgroundColor3 = Color3.new(0, 0, 0)
	btn.BorderColor3 = Color3.new(1, 1, 1)
	btn.TextColor3 = Color3.new(1, 1, 1)
	btn.MouseButton1Down:Connect(function() moveInput[dir] = true end)
	btn.MouseButton1Up:Connect(function() moveInput[dir] = false end)
	btn.MouseLeave:Connect(function() moveInput[dir] = false end)
end

local flying = false
local flySpeed = 60
local bodyVelocity

local function startFlying()
	local char = player.Character or player.CharacterAdded:Wait()
	local hrp = char:WaitForChild("HumanoidRootPart")

	bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.Velocity = Vector3.zero
	bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
	bodyVelocity.Parent = hrp

	flying = true

	while flying do
		local cam = workspace.CurrentCamera
		local direction = Vector3.zero

		if moveInput.Up then direction += cam.CFrame.LookVector end
		if moveInput.Down then direction -= cam.CFrame.LookVector end
		if moveInput.Left then direction -= cam.CFrame.RightVector end
		if moveInput.Right then direction += cam.CFrame.RightVector end

		if direction.Magnitude > 0 then
			bodyVelocity.Velocity = direction.Unit * flySpeed
		else
			bodyVelocity.Velocity = Vector3.zero
		end

		task.wait()
	end

	bodyVelocity:Destroy()
end

flyButton.MouseButton1Click:Connect(function()
	if flying then
		flying = false
		flyButton.Text = "Fly"
	else
		flyButton.Text = "Stop"
		startFlying()
	end
end)

Features & Information

Fly

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts