local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer -- 1. CRIANDO A GUI (CAIXA E TEXTO) local screenGui = Instance.new("ScreenGui") screenGui.Name = "FlySystem" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 150, 0, 50) frame.Position = UDim2.new(0.5, -75, 0.1, 0) -- Topo da tela frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Começa Vermelho frame.BorderSizePixel = 2 frame.Parent = screenGui local button = Instance.new("TextButton") button.Size = UDim2.new(1, 0, 1, 0) button.BackgroundTransparency = 1 button.Text = "FLY: OFF" button.TextColor3 = Color3.fromRGB(255, 255, 255) button.Font = Enum.Font.SourceSansBold button.TextSize = 20 button.Parent = frame -- 2. VARIÁVEIS DE CONTROLE local flying = false local speed = 100 local bodyVelocity local function toggleFly() local character = player.Character if not character then return end local hrp = character:FindFirstChild("HumanoidRootPart") local humanoid = character:FindFirstChild("Humanoid") if not hrp or not humanoid then return end flying = not flying if flying then -- Fica VERDE e liga o voo frame.BackgroundColor3 = Color3.fromRGB(0, 255, 0) button.Text = "FLY: ON" humanoid.PlatformStand = true -- Usando BodyVelocity (mais estável para scripts simples) bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.MaxForce = Vector3.new(1, 1, 1) * math.huge bodyVelocity.Velocity = Vector3.new(0, 0, 0) bodyVelocity.Parent = hrp -- Loop de movimento task.spawn(function() while flying and hrp.Parent do local camCF = workspace.CurrentCamera.CFrame local direction = Vector3.new(0,0,0) -- Voar para onde a câmera olha direction = camCF.LookVector -- Subir/Descer Manual (Eixo Y) if UserInputService:IsKeyDown(Enum.KeyCode.Space) then direction = direction + Vector3.new(0, 1, 0) elseif UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then direction = direction + Vector3.new(0, -1, 0) end bodyVelocity.Velocity = direction.Unit * speed RunService.RenderStepped:Wait() end end) else -- Fica VERMELHO e desliga flying = false frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0) button.Text = "FLY: OFF" if bodyVelocity then bodyVelocity:Destroy() end humanoid.PlatformStand = false humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) end end button.MouseButton1Click:Connect(toggleFly) -- Reset se o personagem morrer player.CharacterAdded:Connect(function() flying = false frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0) button.Text = "FLY: OFF" end)