local Speed = 30 local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local LocalPlayer = Players.LocalPlayer local HumanoidRP = LocalPlayer.Character:WaitForChild("HumanoidRootPart") local isFlying = false local flyConnection = nil local BV, BG = nil, nil local ScreenGui = Instance.new("ScreenGui") local DragBall = Instance.new("TextButton") local FlyPanel = Instance.new("Frame") local FlyToggle = Instance.new("TextButton") local SpeedInput = Instance.new("TextBox") local SpeedLabel = Instance.new("TextLabel") local FlyControls = Instance.new("Frame") local ForwardButton = Instance.new("TextButton") local BackwardButton = Instance.new("TextButton") local LeftButton = Instance.new("TextButton") local RightButton = Instance.new("TextButton") local VerticalControls = Instance.new("Frame") local UpButton = Instance.new("TextButton") local DownButton = Instance.new("TextButton") ScreenGui.Parent = game.CoreGui ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling DragBall.Name = "DragBall" DragBall.Parent = ScreenGui DragBall.BackgroundColor3 = Color3.fromRGB(0, 0, 0) DragBall.BorderColor3 = Color3.fromRGB(255, 165, 0) DragBall.Position = UDim2.new(0, 10, 0, 10) DragBall.Size = UDim2.new(0, 80, 0, 80) DragBall.Font = Enum.Font.SourceSans DragBall.Text = "happy飞车" DragBall.TextColor3 = Color3.fromRGB(255, 255, 255) DragBall.TextScaled = true DragBall.TextSize = 14.000 DragBall.TextWrapped = true DragBall.ZIndex = 10 DragBall.Active = true DragBall.Draggable = true FlyPanel.Name = "FlyPanel" FlyPanel.Parent = ScreenGui FlyPanel.BackgroundColor3 = Color3.fromRGB(0, 0, 0) FlyPanel.BorderSizePixel = 1 FlyPanel.BorderColor3 = Color3.fromRGB(255, 165, 0) FlyPanel.Position = UDim2.new(0, 90, 0, 10) FlyPanel.Size = UDim2.new(0, 150, 0, 120) FlyPanel.Visible = false FlyPanel.ZIndex = 5 FlyToggle.Name = "FlyToggle" FlyToggle.Parent = FlyPanel FlyToggle.BackgroundColor3 = Color3.fromRGB(0, 0, 0) FlyToggle.BorderColor3 = Color3.fromRGB(255, 165, 0) FlyToggle.Position = UDim2.new(0, 10, 0, 10) FlyToggle.Size = UDim2.new(0, 130, 0, 40) FlyToggle.Font = Enum.Font.SourceSans FlyToggle.Text = "开始飞行" FlyToggle.TextColor3 = Color3.fromRGB(255, 255, 255) FlyToggle.TextScaled = true FlyToggle.TextSize = 14.000 FlyToggle.TextWrapped = true FlyToggle.ZIndex = 6 SpeedLabel.Name = "SpeedLabel" SpeedLabel.Parent = FlyPanel SpeedLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0) SpeedLabel.Position = UDim2.new(0, 10, 0, 60) SpeedLabel.Size = UDim2.new(0, 60, 0, 25) SpeedLabel.Font = Enum.Font.SourceSans SpeedLabel.Text = "飞行速度:" SpeedLabel.TextColor3 = Color3.fromRGB(255, 255, 255) SpeedLabel.TextScaled = true SpeedLabel.TextSize = 12.000 SpeedLabel.TextWrapped = true SpeedLabel.TextXAlignment = Enum.TextXAlignment.Left SpeedLabel.ZIndex = 6 SpeedInput.Name = "SpeedInput" SpeedInput.Parent = FlyPanel SpeedInput.BackgroundColor3 = Color3.fromRGB(0, 0, 0) SpeedInput.BorderColor3 = Color3.fromRGB(255, 165, 0) SpeedInput.Position = UDim2.new(0, 75, 0, 60) SpeedInput.Size = UDim2.new(0, 65, 0, 25) SpeedInput.Font = Enum.Font.SourceSans SpeedInput.PlaceholderText = tostring(Speed) SpeedInput.Text = "" SpeedInput.TextColor3 = Color3.fromRGB(255, 255, 255) SpeedInput.TextScaled = true SpeedInput.TextSize = 14.000 SpeedInput.ZIndex = 6 FlyControls.Name = "FlyControls" FlyControls.Parent = ScreenGui FlyControls.BackgroundColor3 = Color3.fromRGB(0, 0, 0) FlyControls.BorderColor3 = Color3.fromRGB(255, 165, 0) FlyControls.Position = UDim2.new(0, 20, 1, -180) FlyControls.Size = UDim2.new(0, 240, 0, 160) FlyControls.Visible = false FlyControls.ZIndex = 8 LeftButton.Name = "LeftButton" LeftButton.Parent = FlyControls LeftButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) LeftButton.BorderColor3 = Color3.fromRGB(255, 165, 0) LeftButton.Position = UDim2.new(0, 10, 0, 50) LeftButton.Size = UDim2.new(0, 60, 0, 60) LeftButton.Font = Enum.Font.SourceSans LeftButton.Text = "向左" LeftButton.TextColor3 = Color3.fromRGB(255, 255, 255) LeftButton.TextScaled = true LeftButton.TextSize = 14.000 LeftButton.TextWrapped = true LeftButton.ZIndex = 9 ForwardButton.Name = "ForwardButton" ForwardButton.Parent = FlyControls ForwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) ForwardButton.BorderColor3 = Color3.fromRGB(255, 165, 0) ForwardButton.Position = UDim2.new(0, 80, 0, 10) ForwardButton.Size = UDim2.new(0, 60, 0, 60) ForwardButton.Font = Enum.Font.SourceSans ForwardButton.Text = "前进" ForwardButton.TextColor3 = Color3.fromRGB(255, 255, 255) ForwardButton.TextScaled = true ForwardButton.TextSize = 14.000 ForwardButton.TextWrapped = true ForwardButton.ZIndex = 9 BackwardButton.Name = "BackwardButton" BackwardButton.Parent = FlyControls BackwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) BackwardButton.BorderColor3 = Color3.fromRGB(255, 165, 0) BackwardButton.Position = UDim2.new(0, 80, 0, 90) BackwardButton.Size = UDim2.new(0, 60, 0, 60) BackwardButton.Font = Enum.Font.SourceSans BackwardButton.Text = "后退" BackwardButton.TextColor3 = Color3.fromRGB(255, 255, 255) BackwardButton.TextScaled = true BackwardButton.TextSize = 14.000 BackwardButton.TextWrapped = true BackwardButton.ZIndex = 9 RightButton.Name = "RightButton" RightButton.Parent = FlyControls RightButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) RightButton.BorderColor3 = Color3.fromRGB(255, 165, 0) RightButton.Position = UDim2.new(0, 150, 0, 50) RightButton.Size = UDim2.new(0, 60, 0, 60) RightButton.Font = Enum.Font.SourceSans RightButton.Text = "向右" RightButton.TextColor3 = Color3.fromRGB(255, 255, 255) RightButton.TextScaled = true RightButton.TextSize = 14.000 RightButton.TextWrapped = true RightButton.ZIndex = 9 VerticalControls.Name = "VerticalControls" VerticalControls.Parent = ScreenGui VerticalControls.BackgroundColor3 = Color3.fromRGB(0, 0, 0) VerticalControls.BorderColor3 = Color3.fromRGB(255, 165, 0) VerticalControls.Position = UDim2.new(1, -100, 1, -180) VerticalControls.Size = UDim2.new(0, 80, 0, 160) VerticalControls.Visible = false VerticalControls.ZIndex = 8 UpButton.Name = "UpButton" UpButton.Parent = VerticalControls UpButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) UpButton.BorderColor3 = Color3.fromRGB(255, 165, 0) UpButton.Position = UDim2.new(0, 10, 0, 10) UpButton.Size = UDim2.new(0, 60, 0, 60) UpButton.Font = Enum.Font.SourceSans UpButton.Text = "向上" UpButton.TextColor3 = Color3.fromRGB(255, 255, 255) UpButton.TextScaled = true UpButton.TextSize = 14.000 UpButton.TextWrapped = true UpButton.ZIndex = 9 DownButton.Name = "DownButton" DownButton.Parent = VerticalControls DownButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) DownButton.BorderColor3 = Color3.fromRGB(255, 165, 0) DownButton.Position = UDim2.new(0, 10, 0, 90) DownButton.Size = UDim2.new(0, 60, 0, 60) DownButton.Font = Enum.Font.SourceSans DownButton.Text = "向下" DownButton.TextColor3 = Color3.fromRGB(255, 255, 255) DownButton.TextScaled = true DownButton.TextSize = 14.000 DownButton.TextWrapped = true DownButton.ZIndex = 9 local isMovingForward = false local isMovingBackward = false local isMovingLeft = false local isMovingRight = false local isMovingUp = false local isMovingDown = false local smartFlyMode = false local originalSeatPart = nil local function setCharacterLookDirection(character, lookVector) local humanoid = character:FindFirstChildOfClass("Humanoid") if not humanoid then return end if smartFlyMode and humanoid.Sit then return end if humanoid.RigType == Enum.HumanoidRigType.R6 then local torso = character:FindFirstChild("Torso") if torso then local currentCFrame = torso.CFrame local newCFrame = CFrame.new(currentCFrame.Position, currentCFrame.Position + lookVector) torso.CFrame = newCFrame end else local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if humanoidRootPart then local currentCFrame = humanoidRootPart.CFrame local newCFrame = CFrame.new(currentCFrame.Position, currentCFrame.Position + lookVector) humanoidRootPart.CFrame = newCFrame end end end local function canCharacterFly(character) local humanoid = character:FindFirstChildOfClass("Humanoid") if not humanoid then return false end if humanoid.Health <= 0 then return false end local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if not humanoidRootPart then return false end return true end local function isCharacterSitting(character) local humanoid = character:FindFirstChildOfClass("Humanoid") return humanoid and humanoid.Sit end local function getSeatedPart(character) local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid and humanoid.Sit then return humanoid.SeatPart end return nil end local function startFlying() if isFlying then return end if not canCharacterFly(LocalPlayer.Character) then print("can't start flying") return end local isSitting = isCharacterSitting(LocalPlayer.Character) local seatPart = getSeatedPart(LocalPlayer.Character) if isSitting and seatPart then smartFlyMode = true originalSeatPart = seatPart else smartFlyMode = false originalSeatPart = nil end isFlying = true FlyToggle.Text = "停止飞行" FlyToggle.BackgroundColor3 = Color3.fromRGB(50, 0, 0) FlyControls.Visible = true VerticalControls.Visible = true BV = Instance.new("BodyVelocity") BG = Instance.new("BodyGyro") BV.Parent = HumanoidRP BG.Parent = HumanoidRP BG.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) BG.D = 5000 BG.P = 50000 BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge) BV.Velocity = Vector3.new(0, 0, 0) isMovingForward = false isMovingBackward = false isMovingLeft = false isMovingRight = false isMovingUp = false isMovingDown = false flyConnection = RunService.Heartbeat:Connect(function() if not isFlying or not HumanoidRP or not BV or not BG then return end if not canCharacterFly(LocalPlayer.Character) then stopFlying() return end local camera = workspace.CurrentCamera local currentSpeed = Speed if SpeedInput.Text ~= "" and tonumber(SpeedInput.Text) then currentSpeed = tonumber(SpeedInput.Text) end local cameraLookVector = camera.CFrame.LookVector local cameraRightVector = camera.CFrame.RightVector if smartFlyMode and isCharacterSitting(LocalPlayer.Character) then BG.CFrame = CFrame.new(HumanoidRP.Position, HumanoidRP.Position + cameraLookVector) else setCharacterLookDirection(LocalPlayer.Character, cameraLookVector) BG.CFrame = CFrame.new(HumanoidRP.Position, HumanoidRP.Position + cameraLookVector) end local moveDirection = Vector3.new(0, 0, 0) if isMovingForward then moveDirection = moveDirection + cameraLookVector elseif isMovingBackward then moveDirection = moveDirection - cameraLookVector end if isMovingLeft then moveDirection = moveDirection - cameraRightVector end if isMovingRight then moveDirection = moveDirection + cameraRightVector end if isMovingUp then moveDirection = moveDirection + Vector3.new(0, 1, 0) end if isMovingDown then moveDirection = moveDirection + Vector3.new(0, -1, 0) 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 if moveDirection.Magnitude > 0 then BV.Velocity = moveDirection.Unit * currentSpeed else BV.Velocity = Vector3.new(0, 0, 0) end end) end local function stopFlying() if not isFlying then return end isFlying = false smartFlyMode = false originalSeatPart = nil FlyToggle.Text = "开始飞行" FlyToggle.BackgroundColor3 = Color3.fromRGB(0, 0, 0) FlyControls.Visible = false VerticalControls.Visible = false isMovingForward = false isMovingBackward = false isMovingLeft = false isMovingRight = false isMovingUp = false isMovingDown = false ForwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) BackwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) LeftButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) RightButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) UpButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) DownButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) if flyConnection then flyConnection:Disconnect() flyConnection = nil end if BV then BV:Destroy() BV = nil end if BG then BG:Destroy() BG = nil end end DragBall.MouseButton1Click:Connect(function() FlyPanel.Visible = not FlyPanel.Visible if FlyPanel.Visible then FlyPanel.Position = UDim2.new(0, DragBall.Position.X.Offset + DragBall.Size.X.Offset, 0, DragBall.Position.Y.Offset) end end) FlyToggle.MouseButton1Click:Connect(function() if isFlying then stopFlying() else startFlying() end end) ForwardButton.MouseButton1Down:Connect(function() isMovingForward = true ForwardButton.BackgroundColor3 = Color3.fromRGB(0, 50, 0) end) ForwardButton.MouseButton1Up:Connect(function() isMovingForward = false ForwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) ForwardButton.MouseLeave:Connect(function() isMovingForward = false ForwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) BackwardButton.MouseButton1Down:Connect(function() isMovingBackward = true BackwardButton.BackgroundColor3 = Color3.fromRGB(50, 0, 0) end) BackwardButton.MouseButton1Up:Connect(function() isMovingBackward = false BackwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) BackwardButton.MouseLeave:Connect(function() isMovingBackward = false BackwardButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) LeftButton.MouseButton1Down:Connect(function() isMovingLeft = true LeftButton.BackgroundColor3 = Color3.fromRGB(50, 50, 0) end) LeftButton.MouseButton1Up:Connect(function() isMovingLeft = false LeftButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) LeftButton.MouseLeave:Connect(function() isMovingLeft = false LeftButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) RightButton.MouseButton1Down:Connect(function() isMovingRight = true RightButton.BackgroundColor3 = Color3.fromRGB(50, 50, 0) end) RightButton.MouseButton1Up:Connect(function() isMovingRight = false RightButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) RightButton.MouseLeave:Connect(function() isMovingRight = false RightButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) UpButton.MouseButton1Down:Connect(function() isMovingUp = true UpButton.BackgroundColor3 = Color3.fromRGB(0, 0, 50) end) UpButton.MouseButton1Up:Connect(function() isMovingUp = false UpButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) UpButton.MouseLeave:Connect(function() isMovingUp = false UpButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) DownButton.MouseButton1Down:Connect(function() isMovingDown = true DownButton.BackgroundColor3 = Color3.fromRGB(0, 0, 50) end) DownButton.MouseButton1Up:Connect(function() isMovingDown = false DownButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) DownButton.MouseLeave:Connect(function() isMovingDown = false DownButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) end) SpeedInput.FocusLost:Connect(function(enterPressed) if SpeedInput.Text ~= "" and tonumber(SpeedInput.Text) then local newSpeed = tonumber(SpeedInput.Text) if newSpeed and newSpeed > 0 then Speed = newSpeed else SpeedInput.Text = "" end end end) local function updatePanelPosition() if FlyPanel.Visible then FlyPanel.Position = UDim2.new(0, DragBall.Position.X.Offset + DragBall.Size.X.Offset, 0, DragBall.Position.Y.Offset) end end DragBall.Changed:Connect(function(property) if property == "Position" then updatePanelPosition() end end) LocalPlayer.CharacterAdded:Connect(function(character) HumanoidRP = character:WaitForChild("HumanoidRootPart") stopFlying() local humanoid = character:WaitForChild("Humanoid") humanoid:GetPropertyChangedSignal("Sit"):Connect(function() if isFlying then local currentSeat = getSeatedPart(character) if humanoid.Sit and currentSeat then smartFlyMode = true originalSeatPart = currentSeat elseif not humanoid.Sit then smartFlyMode = false originalSeatPart = nil end end end) end) print("Happy flying car loaded! Click the floating ball to open control panel.")