local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local camera = workspace.CurrentCamera -- State Variables local flying = false local flySpeed = 50 local bodyVelocity local bodyGyro local renderConnection -- Create UI local screenGui = Instance.new("ScreenGui") screenGui.Name = "Fly UI v1" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local mainFrame = Instance.new("Frame") mainFrame.Name = "MainFrame" mainFrame.Size = UDim2.new(0, 220, 0, 140) mainFrame.Position = UDim2.new(0.05, 0, 0.4, 0) mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 35) mainFrame.BorderSizePixel = 0 mainFrame.Active = true mainFrame.Draggable = true mainFrame.Parent = screenGui local uiCorner = Instance.new("UICorner") uiCorner.CornerRadius = UDim.new(0, 8) uiCorner.Parent = mainFrame local titleLabel = Instance.new("TextLabel") titleLabel.Name = "Title" titleLabel.Size = UDim2.new(1, 0, 0, 32) titleLabel.BackgroundColor3 = Color3.fromRGB(45, 45, 52) titleLabel.BorderSizePixel = 0 titleLabel.Text = "Fly UI v1" titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255) titleLabel.Font = Enum.Font.GothamBold titleLabel.TextSize = 16 titleLabel.Parent = mainFrame local titleCorner = Instance.new("UICorner") titleCorner.CornerRadius = UDim.new(0, 8) titleCorner.Parent = titleLabel -- Speed Input Label & TextBox local speedLabel = Instance.new("TextLabel") speedLabel.Size = UDim2.new(0.45, 0, 0, 30) speedLabel.Position = UDim2.new(0.05, 0, 0.32, 0) speedLabel.BackgroundTransparency = 1 speedLabel.Text = "Fly Speed:" speedLabel.TextColor3 = Color3.fromRGB(220, 220, 220) speedLabel.Font = Enum.Font.Gotham speedLabel.TextSize = 14 speedLabel.TextXAlignment = Enum.TextXAlignment.Left speedLabel.Parent = mainFrame local speedBox = Instance.new("TextBox") speedBox.Name = "SpeedEditor" speedBox.Size = UDim2.new(0.45, 0, 0, 30) speedBox.Position = UDim2.new(0.5, 0, 0.32, 0) speedBox.BackgroundColor3 = Color3.fromRGB(50, 50, 58) speedBox.TextColor3 = Color3.fromRGB(255, 255, 255) speedBox.Font = Enum.Font.GothamSemibold speedBox.TextSize = 14 speedBox.Text = tostring(flySpeed) speedBox.PlaceholderText = "Speed" speedBox.Parent = mainFrame local boxCorner = Instance.new("UICorner") boxCorner.CornerRadius = UDim.new(0, 6) boxCorner.Parent = speedBox -- Toggle Button local toggleBtn = Instance.new("TextButton") toggleBtn.Name = "ToggleButton" toggleBtn.Size = UDim2.new(0.9, 0, 0, 36) toggleBtn.Position = UDim2.new(0.05, 0, 0.65, 0) toggleBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 60) toggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255) toggleBtn.Font = Enum.Font.GothamBold toggleBtn.TextSize = 15 toggleBtn.Text = "Fly: OFF" toggleBtn.Parent = mainFrame local btnCorner = Instance.new("UICorner") btnCorner.CornerRadius = UDim.new(0, 6) btnCorner.Parent = toggleBtn -- Update Speed from TextBox speedBox.FocusLost:Connect(function() local num = tonumber(speedBox.Text) if num and num > 0 then flySpeed = num else speedBox.Text = tostring(flySpeed) end end) -- MovementPlatform Fly Logic local function startFly() local character = player.Character if not character then return end local humanoid = character:FindFirstChildOfClass("Humanoid") local rootPart = character:FindFirstChild("HumanoidRootPart") if not humanoid or not rootPart then return end flying = true toggleBtn.Text = "Fly: ON" toggleBtn.BackgroundColor3 = Color3.fromRGB(60, 180, 75) -- Enable PlatformStand (MovementPlatform state) humanoid.PlatformStand = true -- Construct physics movers bodyGyro = Instance.new("BodyGyro") bodyGyro.P = 9e4 bodyGyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9) bodyGyro.CFrame = rootPart.CFrame bodyGyro.Parent = rootPart bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9) bodyVelocity.Parent = rootPart renderConnection = RunService.RenderStepped:Connect(function() if not flying or not rootPart or not humanoid then return end local moveDir = Vector3.new(0, 0, 0) local camCF = camera.CFrame -- Directional inputs relative to camera if UserInputService:IsKeyDown(Enum.KeyCode.W) then moveDir = moveDir + camCF.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then moveDir = moveDir - camCF.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then moveDir = moveDir - camCF.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then moveDir = moveDir + camCF.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) or UserInputService:IsKeyDown(Enum.KeyCode.E) then moveDir = moveDir + Vector3.new(0, 1, 0) end if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.Q) then moveDir = moveDir - Vector3.new(0, 1, 0) end if moveDir.Magnitude > 0 then moveDir = moveDir.Unit end bodyVelocity.Velocity = moveDir * flySpeed bodyGyro.CFrame = camCF end) end local function stopFly() flying = false toggleBtn.Text = "Fly: OFF" toggleBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 60) if renderConnection then renderConnection:Disconnect() renderConnection = nil end if bodyVelocity then bodyVelocity:Destroy() bodyVelocity = nil end if bodyGyro then bodyGyro:Destroy() bodyGyro = nil end local character = player.Character if character then local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid then humanoid.PlatformStand = false end end end -- Toggle Button Event toggleBtn.MouseButton1Click:Connect(function() if flying then stopFly() else startFly() end end) -- Clean up on character respawn player.CharacterAdded:Connect(function() if flying then stopFly() end end)