local Plr = game:GetService("Players").LocalPlayer
local Mouse = Plr:GetMouse()
local Frame = 0
local Flying = false
local Speed = 50
-- Функция полета
local function ToggleFly()
Flying = not Flying
if Flying then
local T = Plr.Character.HumanoidRootPart
local BG = Instance.new("BodyGyro", T)
local BV = Instance.new("BodyVelocity", T)
BG.P = 9e4
BG.maxTorque = Vector3.new(9e9, 9e9, 9e9)
BG.cframe = T.CFrame
BV.velocity = Vector3.new(0, 0.1, 0)
BV.maxForce = Vector3.new(9e9, 9e9, 9e9)
spawn(function()
repeat wait()
Plr.Character.Humanoid.PlatformStand = true
if Plr.Character:FindFirstChild("HumanoidRootPart") then
-- Включение Ноуклипа во время полета
for _, v in pairs(Plr.Character:GetDescendants()) do
if v:IsA("BasePart") then v.CanCollide = false end
end
local TargetVel = Vector3.new(0, 0.1, 0)
local Camera = workspace.CurrentCamera
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.W) then TargetVel = TargetVel + (Camera.CFrame.lookVector * Speed) end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.S) then TargetVel = TargetVel - (Camera.CFrame.lookVector * Speed) end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.A) then TargetVel = TargetVel - (Camera.CFrame.lookVector.RightVector * Speed) end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.D) then TargetVel = TargetVel + (Camera.CFrame.lookVector.RightVector * Speed) end
BV.velocity = TargetVel
BG.cframe = Camera.CFrame
end
until not Flying
BG:Destroy()
BV:Destroy()
Plr.Character.Humanoid.PlatformStand = false
end)
end
end
-- Активация на клавишу E (английскую)
Mouse.KeyDown:connect(function(Key)
if Key:lower() == "e" then
ToggleFly()
end
end)