
Key RequiredUniversal

local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local player = Players.LocalPlayer
local pg = player:WaitForChild("PlayerGui")
local flying = false
local flySpeed = 50
local minSpeed, maxSpeed = 10, 200
local bv, bg
local character, humanoid, root
local function getChar()
character = player.Character or player.CharacterAdded:Wait()
humanoid = character:WaitForChild("Humanoid")
root = character:WaitForChild("HumanoidRootPart")
end
task.spawn(getChar)
local old = pg:FindFirstChild("Fly gui mobile")
if old then old:Destroy() end
local sg = Instance.new("ScreenGui")
sg.Name = "Fly gui mobile"
sg.ResetOnSpawn = false
sg.IgnoreGuiInset = true
sg.DisplayOrder = 999999
sg.Enabled = true
sg.Parent = pg
local main = Instance.new("Frame")
main.Size = UDim2.fromOffset(280, 180)
main.Position = UDim2.fromOffset(
math.floor(workspace.CurrentCamera.ViewportSize.X / 2 - 140),
math.floor(workspace.CurrentCamera.ViewportSize.Y * 0.55)
)
main.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
main.BorderSizePixel = 0
main.Active = true
main.Parent = sg
Instance.new("UICorner", main).CornerRadius = UDim.new(0, 12)
local stroke = Instance.new("UIStroke", main)
stroke.Color = Color3.fromRGB(80, 80, 120)
stroke.Thickness = 2
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 36)
title.BackgroundColor3 = Color3.fromRGB(40, 40, 60)
title.BorderSizePixel = 0
title.Text = "Fly GUI Mobile"
title.TextColor3 = Color3.new(1, 1, 1)
title.TextSize = 18
title.Font = Enum.Font.GothamBold
title.Parent = main
Instance.new("UICorner", title).CornerRadius = UDim.new(0, 12)
do
local dragging = false
local offset = Vector2.zero
title.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
local abs = main.AbsolutePosition
offset = Vector2.new(input.Position.X - abs.X, input.Position.Y - abs.Y)
end
end)
UIS.InputChanged:Connect(function(input)
if not dragging then return end
if input.UserInputType == Enum.UserInputType.MouseMovement
or input.UserInputType == Enum.UserInputType.Touch then
main.Position = UDim2.fromOffset(input.Position.X - offset.X, input.Position.Y - offset.Y)
end
end)
UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch then
dragging = false
end
end)
end
local btn = Instance.new("TextButton")
btn.Size = UDim2.new(0.85, 0, 0, 42)
btn.Position = UDim2.new(0.075, 0, 0, 50)
btn.BackgroundColor3 = Color3.fromRGB(60, 180, 80)
btn.BorderSizePixel = 0
btn.Text = "ATIVAR FLY"
btn.TextColor3 = Color3.new(1, 1, 1)
btn.TextSize = 16
btn.Font = Enum.Font.GothamBold
btn.Parent = main
Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 8)
local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, 0, 0, 24)
label.Position = UDim2.new(0, 0, 0, 100)
label.BackgroundTransparency = 1
label.Text = "Velocidade: 50"
label.TextColor3 = Color3.fromRGB(200, 200, 220)
label.TextSize = 14
label.Font = Enum.Font.Gotham
label.Parent = main
local track = Instance.new("Frame")
track.Size = UDim2.new(0.85, 0, 0, 10)
track.Position = UDim2.new(0.075, 0, 0, 135)
track.BackgroundColor3 = Color3.fromRGB(50, 50, 70)
track.BorderSizePixel = 0
track.Parent = main
Instance.new("UICorner", track).CornerRadius = UDim.new(1, 0)
local fill = Instance.new("Frame")
fill.Size = UDim2.new(0.22, 0, 1, 0)
fill.BackgroundColor3 = Color3.fromRGB(100, 140, 255)
fill.BorderSizePixel = 0
fill.Parent = track
Instance.new("UICorner", fill).CornerRadius = UDim.new(1, 0)
local thumb = Instance.new("Frame")
thumb.Size = UDim2.fromOffset(22, 22)
thumb.Position = UDim2.new(0.22, -11, 0.5, -11)
thumb.BackgroundColor3 = Color3.new(1, 1, 1)
thumb.BorderSizePixel = 0
thumb.Parent = track
Instance.new("UICorner", thumb).CornerRadius = UDim.new(1, 0)
local function stopFly()
flying = false
if bv then bv:Destroy() bv = nil end
if bg then bg:Destroy() bg = nil end
if humanoid then humanoid.PlatformStand = false end
btn.Text = "ATIVAR FLY"
btn.BackgroundColor3 = Color3.fromRGB(60, 180, 80)
end
local function startFly()
if not root or not root.Parent then getChar() end
if not root then return end
flying = true
bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
bv.Velocity = Vector3.zero
bv.Parent = root
bg = Instance.new("BodyGyro")
bg.MaxTorque = Vector3.new(1e9, 1e9, 1e9)
bg.P = 1e4
bg.Parent = root
humanoid.PlatformStand = true
btn.Text = "DESATIVAR FLY"
btn.BackgroundColor3 = Color3.fromRGB(200, 60, 60)
end
btn.MouseButton1Click:Connect(function()
if flying then stopFly() else startFly() end
end)
RS.RenderStepped:Connect(function()
if not flying or not bv or not bg or not root or not root.Parent then return end
local cam = workspace.CurrentCamera
local look = cam.CFrame.LookVector
local right = cam.CFrame.RightVector
local move = Vector3.zero
-- teclado: W = onde olha
if UIS:IsKeyDown(Enum.KeyCode.W) then move += look end
if UIS:IsKeyDown(Enum.KeyCode.S) then move -= look end
if UIS:IsKeyDown(Enum.KeyCode.A) then move -= right end
if UIS:IsKeyDown(Enum.KeyCode.D) then move += right end
-- joystick: direção certa (não invertida)
if humanoid then
local md = humanoid.MoveDirection
if md.Magnitude > 0.05 then
local flatLook = Vector3.new(look.X, 0, look.Z)
local flatRight = Vector3.new(right.X, 0, right.Z)
if flatLook.Magnitude > 0.01 then flatLook = flatLook.Unit end
if flatRight.Magnitude > 0.01 then flatRight = flatRight.Unit end
local frente = md:Dot(flatLook)
local lado = md:Dot(flatRight)
-- frente do joystick = direção da câmera (sobe se olhar pra cima)
move += look * frente + right * lado
end
end
bv.Velocity = move.Magnitude > 0 and move.Unit * flySpeed or Vector3.zero
bg.CFrame = cam.CFrame
end)
local sliding = false
local function setSpeed(rel)
rel = math.clamp(rel, 0, 1)
flySpeed = math.floor(minSpeed + (maxSpeed - minSpeed) * rel)
label.Text = "Velocidade: " .. flySpeed
fill.Size = UDim2.new(rel, 0, 1, 0)
thumb.Position = UDim2.new(rel, -11, 0.5, -11)
end
local function fromInput(pos)
local x = track.AbsolutePosition.X
local w = track.AbsoluteSize.X
if w > 0 then setSpeed((pos.X - x) / w) end
end
track.InputBegan:Connect(function(i)
if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then
sliding = true
fromInput(i.Position)
end
end)
thumb.InputBegan:Connect(function(i)
if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then
sliding = true
end
end)
UIS.InputChanged:Connect(function(i)
if sliding and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then
fromInput(i.Position)
end
end)
UIS.InputEnded:Connect(function(i)
if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then
sliding = false
end
end)
player.CharacterAdded:Connect(function()
task.wait(0.3)
getChar()
if flying then stopFly() end
end)
print("Fly GUI - direção corrigida")No comments yet for this script.



