-- Mobile Flight with Custom Joystick local player = game:GetService("Players").LocalPlayer local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") -- Flight settings local flyEnabled = false local flySpeed = 50 local bodyVelocity, bodyGyro -- Create GUI local screenGui = Instance.new("ScreenGui") screenGui.Name = "FlightGUI" screenGui.Parent = player:WaitForChild("PlayerGui") -- Joystick elements local joystickFrame = Instance.new("Frame") joystickFrame.Size = UDim2.new(0, 150, 0, 150) joystickFrame.Position = UDim2.new(0.1, 0, 0.7, 0) joystickFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50) joystickFrame.BackgroundTransparency = 0.7 joystickFrame.Visible = false joystickFrame.Parent = screenGui local joystickDot = Instance.new("Frame") joystickDot.Size = UDim2.new(0, 40, 0, 40) joystickDot.Position = UDim2.new(0.5, -20, 0.5, -20) joystickDot.BackgroundColor3 = Color3.fromRGB(120, 120, 120) joystickDot.BackgroundTransparency = 0.5 joystickDot.Parent = joystickFrame -- Control panel local controlFrame = Instance.new("Frame") controlFrame.Size = UDim2.new(0, 200, 0, 80) controlFrame.Position = UDim2.new(0.5, -100, 0.9, -60) controlFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 50) controlFrame.BackgroundTransparency = 0.3 controlFrame.Parent = screenGui local toggleBtn = Instance.new("TextButton") toggleBtn.Size = UDim2.new(0.9, 0, 0.6, 0) toggleBtn.Position = UDim2.new(0.05, 0, 0.1, 0) toggleBtn.Text = "✈️ FLIGHT: OFF" toggleBtn.TextColor3 = Color3.new(1, 1, 1) toggleBtn.BackgroundColor3 = Color3.fromRGB(80, 50, 120) toggleBtn.Parent = controlFrame -- Flight functions local function startFlight() local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local rootPart = character:WaitForChild("HumanoidRootPart") humanoid.PlatformStand = true -- Flight physics bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.MaxForce = Vector3.new(10000, 10000, 10000) bodyVelocity.Parent = rootPart bodyGyro = Instance.new("BodyGyro") bodyGyro.MaxTorque = Vector3.new(10000, 10000, 10000) bodyGyro.P = 1000 bodyGyro.D = 100 bodyGyro.CFrame = rootPart.CFrame bodyGyro.Parent = rootPart -- Show joystick joystickFrame.Visible = true end local function stopFlight() if bodyVelocity then bodyVelocity:Destroy() end if bodyGyro then bodyGyro:Destroy() end local character = player.Character if character then local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.PlatformStand = false end end -- Hide joystick joystickFrame.Visible = false end -- Joystick movement local joystickActive = false local joystickStartPos = Vector2.new(0, 0) local moveDirection = Vector3.new(0, 0, 0) joystickFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch then joystickActive = true joystickStartPos = Vector2.new(input.Position.X, input.Position.Y) end end) joystickFrame.InputChanged:Connect(function(input) if joystickActive and input.UserInputType == Enum.UserInputType.Touch then local currentPos = Vector2.new(input.Position.X, input.Position.Y) local delta = currentPos - joystickStartPos local maxDistance = joystickFrame.AbsoluteSize.X / 2 -- Limit joystick movement if delta.Magnitude > maxDistance then delta = delta.Unit * maxDistance end -- Update joystick dot position joystickDot.Position = UDim2.new(0.5, delta.X, 0.5, delta.Y) -- Calculate movement direction moveDirection = Vector3.new(delta.X / maxDistance, 0, delta.Y / maxDistance) end end) joystickFrame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch then joystickActive = false joystickDot.Position = UDim2.new(0.5, -20, 0.5, -20) moveDirection = Vector3.new(0, 0, 0) end end) -- Altitude control (double tap) local lastTapTime = 0 UIS.InputBegan:Connect(function(input, processed) if flyEnabled and input.UserInputType == Enum.UserInputType.Touch and not processed then local now = tick() if (now - lastTapTime) < 0.3 then -- Double tap if bodyVelocity then bodyVelocity.Velocity = bodyVelocity.Velocity + Vector3.new(0, flySpeed/2, 0) end end lastTapTime = now end end) -- Update flight movement RunService.Heartbeat:Connect(function() if flyEnabled and bodyVelocity and bodyGyro then local character = player.Character if character then local rootPart = character:FindFirstChild("HumanoidRootPart") if rootPart then -- Apply movement from joystick local moveDir = Vector3.new( moveDirection.X * flySpeed, 0, moveDirection.Z * flySpeed ) bodyVelocity.Velocity = rootPart.CFrame:VectorToWorldSpace(moveDir) -- Maintain orientation bodyGyro.CFrame = CFrame.new(rootPart.Position, rootPart.Position + rootPart.CFrame.LookVector) end end end end) -- Toggle flight toggleBtn.MouseButton1Click:Connect(function() flyEnabled = not flyEnabled if flyEnabled then toggleBtn.Text = "✈️ FLIGHT: ON" toggleBtn.BackgroundColor3 = Color3.fromRGB(80, 160, 80) startFlight() else toggleBtn.Text = "✈️ FLIGHT: OFF" toggleBtn.BackgroundColor3 = Color3.fromRGB(80, 50, 120) stopFlight() end end) -- Clean up game:GetService("StarterGui"):SetCore("ResetButtonCallback", function() flyEnabled = false stopFlight() screenGui:Destroy() end)