--// Services local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") --// Variables local LocalPlayer = Players.LocalPlayer local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") local RootPart = Character:FindFirstChild("HumanoidRootPart") or Character:FindFirstChild("Torso") -- Handle both R15 and R6 local Flying = false local Speed = 50 -- Adjust this value to change fly speed --// GUI local FlyButton = Instance.new("TextButton") FlyButton.Size = UDim2.new(0, 100, 0, 30) FlyButton.Position = UDim2.new(0, 10, 0, 10) FlyButton.Text = "Toggle Fly" FlyButton.BackgroundColor3 = Color3.new(0.2, 0.6, 1) FlyButton.TextColor3 = Color3.new(1, 1, 1) FlyButton.Parent = LocalPlayer.PlayerGui FlyButton.Font = Enum.Font.SourceSansBold FlyButton.TextScaled = true FlyButton.TextWrapped = true --// Functions local function Fly() Flying = not Flying if Flying then Humanoid.PlatformStand = true FlyButton.Text = "Disable Fly" else Humanoid.PlatformStand = false FlyButton.Text = "Enable Fly" end end --// Button Event FlyButton.MouseButton1Click:Connect(Fly) --// Fly Loop RunService.Heartbeat:Connect(function() if Flying then if not Character or not Humanoid or not RootPart then Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait() Humanoid = Character:WaitForChild("Humanoid", 5) -- wait 5 seconds for humanoid RootPart = Character:FindFirstChild("HumanoidRootPart") or Character:FindFirstChild("Torso") -- Handle both R15 and R6 if not Character or not Humanoid or not RootPart then Flying = false -- Disable fly if character parts are not found. Humanoid.PlatformStand = false FlyButton.Text = "Enable Fly" return -- Exit the heartbeat function end end RootPart.Velocity = Vector3.new(0,0,0) local MoveDirection = Vector3.new(0, 0, 0) if UserInputService:IsKeyDown(Enum.KeyCode.W) then MoveDirection = MoveDirection + RootPart.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then MoveDirection = MoveDirection - RootPart.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then MoveDirection = MoveDirection - RootPart.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then MoveDirection = MoveDirection + RootPart.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then MoveDirection = MoveDirection + Vector3.new(0, 1, 0) end if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then MoveDirection = MoveDirection - Vector3.new(0, 1, 0) end RootPart.Velocity = MoveDirection.Unit * Speed end end) ```