Ban and fly players beta
Key Required

Ban and fly players beta

Brookhaven 🏡RPSjsjsnssnsSjsjsnssns 1.1K views 777 executesUpdated Jan 26, 2026
Unrated
00
Lua Script•226 lines (10024 chars)
-- Script principal para ser colocado em ServerScriptService

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")

-- Cria um RemoteEvent no ReplicatedStorage para comunicação Cliente-Servidor
-- Isso é necessário para que o cliente possa pedir ao servidor para banir um jogador
-- e para o servidor controlar o voo do jogador.
local banRemoteEvent = Instance.new("RemoteEvent")
banRemoteEvent.Name = "BanUserEvent"
banRemoteEvent.Parent = ReplicatedStorage

local flyRemoteEvent = Instance.new("RemoteEvent")
flyRemoteEvent.Name = "FlyEvent"
flyRemoteEvent.Parent = ReplicatedStorage

-- Função para banir um jogador (executada no servidor)
banRemoteEvent.OnServerEvent:Connect(function(player, targetUsername)
    local targetPlayer = Players:FindFirstChild(targetUsername)
    if targetPlayer then
        -- Exemplo de como banir. Você pode integrar isso ao seu sistema de banimento.
        -- Para um sistema de banimento real, você precisaria de um datastore para armazenar os bans.
        -- Esta é uma demonstração simples de kick.
        targetPlayer:Kick("Você foi banido do servidor!")
        print(player.Name .. " tentou banir " .. targetUsername)
    else
        print("Jogador " .. targetUsername .. " não encontrado.")
    end
end)

-- Função para controlar o voo (executada no servidor)
flyRemoteEvent.OnServerEvent:Connect(function(player, enableFly, flySpeed)
    local character = player.Character
    if character then
        local humanoid = character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            if enableFly then
                -- Ativa o voo
                local bodyVelocity = Instance.new("BodyVelocity")
                bodyVelocity.MaxForce = Vector3.new(0, math.huge, 0)
                bodyVelocity.Velocity = Vector3.new(0, 0, 0) -- Começa parado
                bodyVelocity.Parent = character.HumanoidRootPart
                bodyVelocity.Name = "FlyBodyVelocity"

                -- Conecta a função de voo ao Humanoid.FreeFalling ou Humanoid.StateChanged
                -- Para um sistema de voo mais robusto, você precisaria de um LocalScript para
                -- controlar o BodyVelocity com base nas entradas do jogador.
                -- Este exemplo é bem básico.
                local flyUpdateConnection
                flyUpdateConnection = game:GetService("RunService").RenderStepped:Connect(function()
                    if character and character.Parent and bodyVelocity and bodyVelocity.Parent then
                        local rootPart = character.HumanoidRootPart
                        local cam = workspace.CurrentCamera

                        if UserInputService:IsKeyDown(Enum.KeyCode.W) then
                            rootPart.CFrame = rootPart.CFrame + cam.CFrame.lookVector * flySpeed
                        end
                        if UserInputService:IsKeyDown(Enum.KeyCode.S) then
                            rootPart.CFrame = rootPart.CFrame - cam.CFrame.lookVector * flySpeed
                        end
                        if UserInputService:IsKeyDown(Enum.KeyCode.A) then
                            rootPart.CFrame = rootPart.CFrame - cam.CFrame.rightVector * flySpeed
                        end
                        if UserInputService:IsKeyDown(Enum.KeyCode.D) then
                            rootPart.CFrame = rootPart.CFrame + cam.CFrame.rightVector * flySpeed
                        end
                        if UserInputService:IsKeyDown(Enum.KeyCode.Space) then
                            rootPart.CFrame = rootPart.CFrame + Vector3.new(0, flySpeed, 0)
                        end
                        if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then
                            rootPart.CFrame = rootPart.CFrame - Vector3.new(0, flySpeed, 0)
                        end
                    else
                        if flyUpdateConnection then
                            flyUpdateConnection:Disconnect()
                        end
                    end
                end)

            else
                -- Desativa o voo
                local bodyVelocity = character.HumanoidRootPart:FindFirstChild("FlyBodyVelocity")
                if bodyVelocity then
                    bodyVelocity:Destroy()
                end
            end
        end
    end
end)


-- Script Local para o cliente (cria a GUI e envia eventos para o servidor)
Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local playerGui = player:WaitForChild("PlayerGui")

        local gui = Instance.new("ScreenGui")
        gui.Name = "AdminPanel"
        gui.Parent = playerGui

        local frame = Instance.new("Frame")
        frame.Name = "MainFrame"
        frame.Size = UDim2.new(0, 300, 0, 200)
        frame.Position = UDim2.new(0.5, -150, 0.5, -100) -- Centralizado
        frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
        frame.BorderSizePixel = 1
        frame.BorderColor3 = Color3.new(0.1, 0.1, 0.1)
        frame.Draggable = true -- Permite arrastar o frame
        frame.Parent = gui

        -- Botão Fechar (X)
        local closeButton = Instance.new("TextButton")
        closeButton.Name = "CloseButton"
        closeButton.Size = UDim2.new(0, 20, 0, 20)
        closeButton.Position = UDim2.new(1, -25, 0, 5)
        closeButton.BackgroundColor3 = Color3.new(0.8, 0, 0)
        closeButton.Text = "X"
        closeButton.TextColor3 = Color3.new(1, 1, 1)
        closeButton.Font = Enum.Font.SourceSansBold
        closeButton.TextSize = 14
        closeButton.Parent = frame

        closeButton.MouseButton1Click:Connect(function()
            gui:Destroy()
        end)

        -- Label "Fly Speed:"
        local flySpeedLabel = Instance.new("TextLabel")
        flySpeedLabel.Name = "FlySpeedLabel"
        flySpeedLabel.Size = UDim2.new(0, 100, 0, 20)
        flySpeedLabel.Position = UDim2.new(0, 10, 0, 40)
        flySpeedLabel.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
        flySpeedLabel.Text = "Fly Speed:"
        flySpeedLabel.TextColor3 = Color3.new(1, 1, 1)
        flySpeedLabel.Font = Enum.Font.SourceSans
        flySpeedLabel.TextSize = 14
        flySpeedLabel.TextXAlignment = Enum.TextXAlignment.Left
        flySpeedLabel.Parent = frame

        -- Textbox de velocidade de voo
        local speedTextbox = Instance.new("TextBox")
        speedTextbox.Name = "SpeedTextbox"
        speedTextbox.Size = UDim2.new(0, 80, 0, 20)
        speedTextbox.Position = UDim2.new(0, 115, 0, 40)
        speedTextbox.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
        speedTextbox.PlaceholderText = "Velocidade"
        speedTextbox.Text = "50" -- Velocidade padrão
        speedTextbox.TextColor3 = Color3.new(1, 1, 1)
        speedTextbox.Font = Enum.Font.SourceSans
        speedTextbox.TextSize = 14
        speedTextbox.Parent = frame

        -- Botão Fly
        local flyButton = Instance.new("TextButton")
        flyButton.Name = "FlyButton"
        flyButton.Size = UDim2.new(0, 80, 0, 25)
        flyButton.Position = UDim2.new(0, 210, 0, 37)
        flyButton.BackgroundColor3 = Color3.new(0, 0.5, 0)
        flyButton.Text = "Fly"
        flyButton.TextColor3 = Color3.new(1, 1, 1)
        flyButton.Font = Enum.Font.SourceSansBold
        flyButton.TextSize = 16
        flyButton.Parent = frame

        local isFlying = false
        flyButton.MouseButton1Click:Connect(function()
            isFlying = not isFlying
            if isFlying then
                flyButton.Text = "Stop Fly"
                flyButton.BackgroundColor3 = Color3.new(0.5, 0, 0)
                local flySpeed = tonumber(speedTextbox.Text) or 50
                flyRemoteEvent:FireServer(true, flySpeed)
            else
                flyButton.Text = "Fly"
                flyButton.BackgroundColor3 = Color3.new(0, 0.5, 0)
                flyRemoteEvent:FireServer(false)
            end
        end)

        -- Label "Username to Ban:"
        local banUserLabel = Instance.new("TextLabel")
        banUserLabel.Name = "BanUserLabel"
        banUserLabel.Size = UDim2.new(0, 150, 0, 20)
        banUserLabel.Position = UDim2.new(0, 10, 0, 80)
        banUserLabel.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
        banUserLabel.Text = "Username to Ban:"
        banUserLabel.TextColor3 = Color3.new(1, 1, 1)
        banUserLabel.Font = Enum.Font.SourceSans
        banUserLabel.TextSize = 14
        banUserLabel.TextXAlignment = Enum.TextXAlignment.Left
        banUserLabel.Parent = frame

        -- Textbox para nome de usuário
        local usernameTextbox = Instance.new("TextBox")
        usernameTextbox.Name = "UsernameTextbox"
        usernameTextbox.Size = UDim2.new(0, 280, 0, 25)
        usernameTextbox.Position = UDim2.new(0, 10, 0, 105)
        usernameTextbox.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
        usernameTextbox.PlaceholderText = "Nome de usuário"
        usernameTextbox.TextColor3 = Color3.new(1, 1, 1)
        usernameTextbox.Font = Enum.Font.SourceSans
        usernameTextbox.TextSize = 16
        usernameTextbox.Parent = frame

        -- Botão Ban User
        local banButton = Instance.new("TextButton")
        banButton.Name = "BanButton"
        banButton.Size = UDim2.new(0, 100, 0, 30)
        banButton.Position = UDim2.new(0, 10, 0, 140)
        banButton.BackgroundColor3 = Color3.new(0.7, 0, 0)
        banButton.Text = "Ban User"
        banButton.TextColor3 = Color3.new(1, 1, 1)
        banButton.Font = Enum.Font.SourceSansBold
        banButton.TextSize = 16
        banButton.Parent = frame

        banButton.MouseButton1Click:Connect(function()
            local targetUsername = usernameTextbox.Text
            if targetUsername ~= "" then
                banRemoteEvent:FireServer(targetUsername)
                usernameTextbox.Text = "" -- Limpa a textbox
            end
        end)
    end)
end)

Features & Information

Ban players,fly

Community Comments (1)

squhzsquhzJan 26, 2026

Doesnt work

More Scripts for Brookhaven 🏡RP