-- ============================================== -- 不吃制作 -- ============================================== local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local lp = Players.LocalPlayer local camera = workspace.CurrentCamera -- --- 状态变量 --- local currentFlyMode = "None" local flySpeed = 70 local hrp, hum -- 获取控制核心 local PlayerModule = require(lp.PlayerScripts:WaitForChild("PlayerModule")) local ControlModule = PlayerModule:GetControls() -- ============================================== -- [核心逻辑] 清理与重置 -- ============================================== local originalCanCollide = {} local descendantConnection = nil local function clearAllFlyResources() if hrp then for _, v in pairs(hrp:GetChildren()) do if v:IsA("BodyVelocity") or v:IsA("BodyGyro") then v:Destroy() end end end if descendantConnection then descendantConnection:Disconnect() descendantConnection = nil end if originalCanCollide then for part, state in pairs(originalCanCollide) do if part and part.Parent then part.CanCollide = state end end table.clear(originalCanCollide) end if hum then hum:ChangeState(Enum.HumanoidStateType.GettingUp) end end local function getCharDetails() local char = lp.Character if not char then return nil, nil end hrp = char:FindFirstChild("HumanoidRootPart") hum = char:FindFirstChild("Humanoid") return hrp, hum end -- ============================================== -- [模式 1] 物理飞行 -- ============================================== local function startPhysicalFly() local root, humanoid = getCharDetails() if not root or not humanoid then return end clearAllFlyResources() currentFlyMode = "Physical" local bv = Instance.new("BodyVelocity", root) bv.MaxForce = Vector3.new(1e6, 1e6, 1e6) local bg = Instance.new("BodyGyro", root) bg.MaxTorque = Vector3.new(1e6, 1e6, 1e6) task.spawn(function() while currentFlyMode == "Physical" and root.Parent do local moveVec = ControlModule:GetMoveVector() if moveVec.Magnitude > 0 then local camCF = camera.CFrame local direction = (camCF.LookVector * -moveVec.Z) + (camCF.RightVector * moveVec.X) bv.Velocity = direction.Unit * flySpeed else bv.Velocity = Vector3.zero end bg.CFrame = camera.CFrame humanoid:ChangeState(Enum.HumanoidStateType.Climbing) task.wait() end if bv then bv:Destroy() end if bg then bg:Destroy() end end) end -- ============================================== -- [模式 2] 穿墙传送飞行 (Warp) -- ============================================== local function startWarpFly() local char = lp.Character local root, humanoid = getCharDetails() if not char or not root or not humanoid then return end clearAllFlyResources() currentFlyMode = "Warp" -- 穿墙逻辑 for _, part in ipairs(char:GetDescendants()) do if part:IsA("BasePart") then originalCanCollide[part] = part.CanCollide part.CanCollide = false end end descendantConnection = char.DescendantAdded:Connect(function(part) if part:IsA("BasePart") then part.CanCollide = false end end) task.spawn(function() local targetPos = root.Position while currentFlyMode == "Warp" and root.Parent do local dt = RunService.Heartbeat:Wait() local mv = ControlModule:GetMoveVector() local cf = camera.CFrame local moveDir = (cf.LookVector * -mv.Z) + (cf.RightVector * mv.X) -- 兼容键盘上下 local vertical = 0 if UserInputService:IsKeyDown(Enum.KeyCode.Space) then vertical = 1 elseif UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then vertical = -1 end targetPos = targetPos + (moveDir + Vector3.new(0, vertical, 0)) * flySpeed * dt root.CFrame = CFrame.new(targetPos) * camera.CFrame.Rotation root.Velocity = Vector3.zero humanoid:ChangeState(Enum.HumanoidStateType.Climbing) -- 不死锁定 if humanoid.Health < humanoid.MaxHealth then humanoid.Health = humanoid.MaxHealth end end end) end -- ============================================== -- [UI 部分] 精简缩小版 -- ============================================== local targetParent = lp:WaitForChild("PlayerGui") if targetParent:FindFirstChild("FlyFusionGui") then targetParent.FlyFusionGui:Destroy() end local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "FlyFusionGui" ScreenGui.Parent = targetParent ScreenGui.ResetOnSpawn = false -- 主面板缩小 local MainFrame = Instance.new("Frame", ScreenGui) MainFrame.Size = UDim2.new(0, 130, 0, 135) -- 整体缩小 MainFrame.Position = UDim2.new(0.05, 0, 0.2, 0) MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) MainFrame.BackgroundTransparency = 0.2 MainFrame.Active = true MainFrame.Draggable = true Instance.new("UICorner", MainFrame).CornerRadius = UDim.new(0, 8) -- 统一按钮样式 local function createBtn(name, text, pos, color) local btn = Instance.new("TextButton", MainFrame) btn.Name = name btn.Size = UDim2.new(1, -16, 0, 30) -- 按钮变矮 btn.Position = pos btn.Text = text btn.BackgroundColor3 = color or Color3.fromRGB(50, 50, 50) btn.TextColor3 = Color3.new(1, 1, 1) btn.Font = Enum.Font.SourceSansBold btn.TextSize = 13 Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6) return btn end local PhysicalBtn = createBtn("PhysBtn", "物理飞行", UDim2.new(0, 8, 0, 8)) local WarpBtn = createBtn("WarpBtn", "穿墙飞行", UDim2.new(0, 8, 0, 43)) -- 速度输入缩小 local SpeedInput = Instance.new("TextBox", MainFrame) SpeedInput.Size = UDim2.new(1, -16, 0, 25) SpeedInput.Position = UDim2.new(0, 8, 0, 78) SpeedInput.PlaceholderText = "速度设置..." SpeedInput.Text = tostring(flySpeed) SpeedInput.BackgroundColor3 = Color3.fromRGB(20, 20, 20) SpeedInput.TextColor3 = Color3.new(1, 1, 1) SpeedInput.Font = Enum.Font.SourceSans SpeedInput.TextSize = 12 Instance.new("UICorner", SpeedInput).CornerRadius = UDim.new(0, 4) local Tip = Instance.new("TextLabel", MainFrame) Tip.Size = UDim2.new(1, 0, 0, 20) Tip.Position = UDim2.new(0, 0, 0, 110) Tip.Text = "再次点击按钮关闭" Tip.TextColor3 = Color3.fromRGB(150, 150, 150) Tip.BackgroundTransparency = 1 Tip.TextSize = 10 -- ============================================== -- [交互逻辑] -- ============================================== local COLOR_ON = Color3.fromRGB(0, 170, 90) local COLOR_OFF = Color3.fromRGB(50, 50, 50) local function updateUI() PhysicalBtn.BackgroundColor3 = (currentFlyMode == "Physical") and COLOR_ON or COLOR_OFF WarpBtn.BackgroundColor3 = (currentFlyMode == "Warp") and COLOR_ON or COLOR_OFF end PhysicalBtn.MouseButton1Click:Connect(function() if currentFlyMode == "Physical" then currentFlyMode = "None"; clearAllFlyResources() else startPhysicalFly() end updateUI() end) WarpBtn.MouseButton1Click:Connect(function() if currentFlyMode == "Warp" then currentFlyMode = "None"; clearAllFlyResources() else startWarpFly() end updateUI() end) SpeedInput.FocusLost:Connect(function() local val = tonumber(SpeedInput.Text) if val then flySpeed = val else SpeedInput.Text = tostring(flySpeed) end end)