local player = game.Players.LocalPlayer local userInputService = game:GetService("UserInputService") local runService = game:GetService("RunService") -- GUI Creation local screenGui = Instance.new("ScreenGui") screenGui.Parent = player:WaitForChild("PlayerGui") screenGui.Name = "FlightMenu" screenGui.ResetOnSpawn = false -- Main Frame (Draggable) local frame = Instance.new("Frame") frame.Parent = screenGui frame.Size = UDim2.new(0, 200, 0, 100) frame.Position = UDim2.new(0.5, -100, 0.5, -50) frame.BackgroundColor3 = Color3.fromRGB(25, 25, 30) frame.BorderSizePixel = 0 frame.Active = true -- Needed for dragging frame.Draggable = true -- Enables dragging local frameCorner = Instance.new("UICorner") frameCorner.CornerRadius = UDim.new(0, 10) frameCorner.Parent = frame -- Title Label (Drag Handle) local title = Instance.new("TextLabel") title.Parent = frame title.Size = UDim2.new(1, 0, 0, 30) title.BackgroundColor3 = Color3.fromRGB(35, 35, 45) title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.GothamBold title.TextSize = 16 title.Text = "✈️ Flight Menu" title.TextStrokeTransparency = 0.8 -- Flight Toggle Button local flightButton = Instance.new("TextButton") flightButton.Parent = frame flightButton.Size = UDim2.new(0.8, 0, 0, 40) flightButton.Position = UDim2.new(0.1, 0, 0.4, 0) flightButton.BackgroundColor3 = Color3.fromRGB(45, 45, 55) flightButton.TextColor3 = Color3.fromRGB(255, 255, 255) flightButton.Font = Enum.Font.Gotham flightButton.TextSize = 16 flightButton.Text = "Enable Flight" local buttonCorner = Instance.new("UICorner") buttonCorner.CornerRadius = UDim.new(0, 6) buttonCorner.Parent = flightButton -- Flight Logic local flying = false local flightSpeed = 50 local bodyVelocity local function toggleFlight() local character = player.Character if not character or not character:FindFirstChild("HumanoidRootPart") then return end local hrp = character.HumanoidRootPart if flying then flying = false flightButton.Text = "Enable Flight" if bodyVelocity then bodyVelocity:Destroy() bodyVelocity = nil end else flying = true flightButton.Text = "Disable Flight" bodyVelocity = Instance.new("BodyVelocity", hrp) bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9) end end flightButton.MouseButton1Click:Connect(toggleFlight) -- Movement While Flying runService.RenderStepped:Connect(function() if flying then local character = player.Character if character and character:FindFirstChild("HumanoidRootPart") then local hrp = character.HumanoidRootPart local moveDirection = Vector3.new() if userInputService:IsKeyDown(Enum.KeyCode.W) then moveDirection = moveDirection + (workspace.CurrentCamera.CFrame.LookVector * flightSpeed) end if userInputService:IsKeyDown(Enum.KeyCode.S) then moveDirection = moveDirection - (workspace.CurrentCamera.CFrame.LookVector * flightSpeed) end if userInputService:IsKeyDown(Enum.KeyCode.A) then moveDirection = moveDirection - (workspace.CurrentCamera.CFrame.RightVector * flightSpeed) end if userInputService:IsKeyDown(Enum.KeyCode.D) then moveDirection = moveDirection + (workspace.CurrentCamera.CFrame.RightVector * flightSpeed) end if userInputService:IsKeyDown(Enum.KeyCode.Space) then moveDirection = moveDirection + Vector3.new(0, flightSpeed, 0) end if userInputService:IsKeyDown(Enum.KeyCode.LeftControl) then moveDirection = moveDirection - Vector3.new(0, flightSpeed, 0) end bodyVelocity.Velocity = moveDirection end end end) -- Toggle GUI with RightCtrl local guiVisible = true userInputService.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode == Enum.KeyCode.RightControl and not gameProcessed then guiVisible = not guiVisible frame.Visible = guiVisible end end)