-- Mobile Fly GUI Script (LocalScript) local player = game.Players.LocalPlayer local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local StarterGui = game:GetService("StarterGui") -- Create GUI local screenGui = Instance.new("ScreenGui") screenGui.Name = "MobileFlyGUI" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local button = Instance.new("TextButton") button.Size = UDim2.new(0, 120, 0, 50) button.Position = UDim2.new(1, -140, 1, -70) -- Bottom right button.BackgroundColor3 = Color3.fromRGB(50, 150, 255) button.TextColor3 = Color3.fromRGB(255, 255, 255) button.TextScaled = true button.Font = Enum.Font.SourceSansBold button.Text = "Fly: OFF" button.Parent = screenGui button.AnchorPoint = Vector2.new(0, 0) -- Fly logic local flying = false local speed = 50 local direction = Vector3.zero local keys = { W = false, A = false, S = false, D = false, Space = false, Shift = false, } -- Touch-based fallback direction (always forward) local function getTouchDirection() local cam = workspace.CurrentCamera return cam and cam.CFrame.LookVector or Vector3.new(0, 0, -1) end -- Keyboard input for PC support UIS.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.W then keys.W = true end if input.KeyCode == Enum.KeyCode.A then keys.A = true end if input.KeyCode == Enum.KeyCode.S then keys.S = true end if input.KeyCode == Enum.KeyCode.D then keys.D = true end if input.KeyCode == Enum.KeyCode.Space then keys.Space = true end if input.KeyCode == Enum.KeyCode.LeftShift then keys.Shift = true end end) UIS.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.W then keys.W = false end if input.KeyCode == Enum.KeyCode.A then keys.A = false end if input.KeyCode == Enum.KeyCode.S then keys.S = false end if input.KeyCode == Enum.KeyCode.D then keys.D = false end if input.KeyCode == Enum.KeyCode.Space then keys.Space = false end if input.KeyCode == Enum.KeyCode.LeftShift then keys.Shift = false end end) -- Update movement direction local function updateDirection() local cam = workspace.CurrentCamera local moveDir = Vector3.zero if UIS.TouchEnabled then moveDir = getTouchDirection() else if keys.W then moveDir += cam.CFrame.LookVector end if keys.S then moveDir -= cam.CFrame.LookVector end if keys.A then moveDir -= cam.CFrame.RightVector end if keys.D then moveDir += cam.CFrame.RightVector end if keys.Space then moveDir += Vector3.new(0, 1, 0) end if keys.Shift then moveDir -= Vector3.new(0, 1, 0) end end direction = moveDir end -- Flying movement RunService.RenderStepped:Connect(function() if flying then updateDirection() local char = player.Character if char and char:FindFirstChild("HumanoidRootPart") then char.HumanoidRootPart.Velocity = direction.Unit * speed end end end) -- Toggle flying on button press button.MouseButton1Click:Connect(function() flying = not flying button.Text = flying and "Fly: ON" or "Fly: OFF" if not flying then local char = player.Character if char and char:FindFirstChild("HumanoidRootPart") then char.HumanoidRootPart.Velocity = Vector3.zero end end end)