local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") -- State local flying = false local flySpeed = 50 local toggleKey = Enum.KeyCode.F local guiToggleKey = Enum.KeyCode.RightShift local waitingForKeyInput = false local waitingForGuiKeyInput = false -- GUI Setup local gui = Instance.new("ScreenGui") gui.Name = "FlyGui" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 400, 0, 140) frame.Position = UDim2.new(0.5, -200, 0.4, 0) frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35) frame.BackgroundTransparency = 0.1 frame.BorderSizePixel = 0 frame.AnchorPoint = Vector2.new(0.5, 0.5) frame.Active = true frame.Draggable = true frame.Visible = true frame.Parent = gui local toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.new(0, 180, 0, 40) toggleButton.Position = UDim2.new(0, 10, 0, 10) toggleButton.BackgroundColor3 = Color3.fromRGB(40, 150, 90) toggleButton.TextColor3 = Color3.new(1, 1, 1) toggleButton.Font = Enum.Font.SourceSansBold toggleButton.TextSize = 20 toggleButton.Text = "Flying: OFF" toggleButton.Parent = frame local speedBox = Instance.new("TextBox") speedBox.Size = UDim2.new(0, 120, 0, 40) speedBox.Position = UDim2.new(0, 200, 0, 10) speedBox.BackgroundColor3 = Color3.fromRGB(60, 60, 60) speedBox.TextColor3 = Color3.new(1, 1, 1) speedBox.Font = Enum.Font.SourceSansBold speedBox.TextSize = 20 speedBox.PlaceholderText = "Speed" speedBox.Text = tostring(flySpeed) speedBox.ClearTextOnFocus = false speedBox.Parent = frame local keybindButton = Instance.new("TextButton") keybindButton.Size = UDim2.new(0, 180, 0, 30) keybindButton.Position = UDim2.new(0, 10, 0, 55) keybindButton.BackgroundColor3 = Color3.fromRGB(40, 90, 180) keybindButton.TextColor3 = Color3.new(1, 1, 1) keybindButton.Font = Enum.Font.SourceSansBold keybindButton.TextSize = 18 keybindButton.Text = "Set Fly Key" keybindButton.Parent = frame local keybindLabel = Instance.new("TextLabel") keybindLabel.Size = UDim2.new(0, 120, 0, 30) keybindLabel.Position = UDim2.new(0, 200, 0, 55) keybindLabel.BackgroundColor3 = Color3.fromRGB(20, 20, 20) keybindLabel.TextColor3 = Color3.new(1, 1, 1) keybindLabel.Font = Enum.Font.SourceSans keybindLabel.TextSize = 18 keybindLabel.Text = toggleKey.Name keybindLabel.BorderSizePixel = 0 keybindLabel.Parent = frame -- GUI TOGGLE KEYBIND local guiKeyButton = Instance.new("TextButton") guiKeyButton.Size = UDim2.new(0, 180, 0, 30) guiKeyButton.Position = UDim2.new(0, 10, 0, 95) guiKeyButton.BackgroundColor3 = Color3.fromRGB(180, 90, 40) guiKeyButton.TextColor3 = Color3.new(1, 1, 1) guiKeyButton.Font = Enum.Font.SourceSansBold guiKeyButton.TextSize = 18 guiKeyButton.Text = "Set GUI Key" guiKeyButton.Parent = frame local guiKeyLabel = Instance.new("TextLabel") guiKeyLabel.Size = UDim2.new(0, 120, 0, 30) guiKeyLabel.Position = UDim2.new(0, 200, 0, 95) guiKeyLabel.BackgroundColor3 = Color3.fromRGB(20, 20, 20) guiKeyLabel.TextColor3 = Color3.new(1, 1, 1) guiKeyLabel.Font = Enum.Font.SourceSans guiKeyLabel.TextSize = 18 guiKeyLabel.Text = guiToggleKey.Name guiKeyLabel.BorderSizePixel = 0 guiKeyLabel.Parent = frame -- Flight local bodyGyro, bodyVelocity local function startFlying() local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart") if not root then return end bodyGyro = Instance.new("BodyGyro") bodyGyro.P = 9e4 bodyGyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9) bodyGyro.CFrame = root.CFrame bodyGyro.Parent = root bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9) bodyVelocity.Parent = root end local function stopFlying() if bodyGyro then bodyGyro:Destroy() bodyGyro = nil end if bodyVelocity then bodyVelocity:Destroy() bodyVelocity = nil end end local function toggleFly() flying = not flying toggleButton.Text = flying and "Flying: ON" or "Flying: OFF" if flying then startFlying() else stopFlying() end end -- Button logic toggleButton.MouseButton1Click:Connect(toggleFly) keybindButton.MouseButton1Click:Connect(function() keybindLabel.Text = "Press key..." waitingForKeyInput = true end) guiKeyButton.MouseButton1Click:Connect(function() guiKeyLabel.Text = "Press key..." waitingForGuiKeyInput = true end) -- Input handling UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if waitingForKeyInput and input.UserInputType == Enum.UserInputType.Keyboard then toggleKey = input.KeyCode keybindLabel.Text = toggleKey.Name waitingForKeyInput = false return end if waitingForGuiKeyInput and input.UserInputType == Enum.UserInputType.Keyboard then guiToggleKey = input.KeyCode guiKeyLabel.Text = guiToggleKey.Name waitingForGuiKeyInput = false return end if input.KeyCode == toggleKey then toggleFly() end end) -- GUI Toggle UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == guiToggleKey then frame.Visible = not frame.Visible end end) -- Flight logic RunService.RenderStepped:Connect(function() if flying and bodyVelocity and bodyGyro then local cam = workspace.CurrentCamera local move = Vector3.zero if UserInputService:IsKeyDown(Enum.KeyCode.W) then move += cam.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then move -= cam.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then move -= cam.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then move += cam.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then move += cam.CFrame.UpVector end if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then move -= cam.CFrame.UpVector end if move.Magnitude > 0 then move = move.Unit * flySpeed end bodyVelocity.Velocity = move bodyGyro.CFrame = cam.CFrame end end) -- Live speed update speedBox:GetPropertyChangedSignal("Text"):Connect(function() local n = tonumber(speedBox.Text) if n and n >= 0 then flySpeed = n end end) -- Reset on respawn player.CharacterAdded:Connect(function(char) character = char humanoidRootPart = character:WaitForChild("HumanoidRootPart") stopFlying() end)