Top.Mail.Ru
Ответы

Как сделать админку в роблоксе — ПОДРОБНЫЙ ГАЙД

Полная админ‑панель для Roblox Studio: подробный гайд

Разберу создание функциональной админ‑панели пошагово — от интерфейса до серверной логики.

Шаг 1. Создание GUI‑интерфейса

  1. В Explorer найдите StarterGui → ПКМ → Insert ObjectScreenGui. Назовите AdminPanel.

  2. Внутри AdminPanel создайте Frame (основное окно) и настройте:

    • Size: {0, 400}, {0, 500};

    • Position: {0.5, -200}, {0.5, -250} (по центру);

    • BackgroundColor3: Color3.fromRGB(30, 30, 30);

    • BorderSizePixel: 0;

    • Visible: false (изначально скрыта).

  3. Добавьте элементы внутри Frame:

    • Заголовок: TextLabel с текстом «Админ‑панель», Size: {1, 0}, {0, 40}, TextColor3: белый.

    • Поле ввода: TextBoxPlayerNameBox, PlaceholderText: «Имя игрока», Size: {0.8, 0}, {0, 30}.

    • Кнопки (каждой задайте Size: {0.4, 0}, {0, 35}):

      • KickButton («Кикнуть»);

      • BanButton («Забанить»);

      • HealButton («Вылечить»);

      • TeleportButton («Телепорт к игроку»);

      • FlyButton («Полет»);

      • GodModeButton («Режим бога»).

    • Список игроков: ScrollingFramePlayerList, Size: {0.9, 0}, {0, 200}, BackgroundTransparency: 1.

    • Кнопка закрытия: TextButtonCloseButton, текст «×», Size: {0, 30}, {0, 30}.

Шаг 2. Настройка RemoteEvents

  1. В ReplicatedStorage создайте:

    • RemoteEventAdminActions (для команд);

    • RemoteFunctionGetPlayerList (запрос списка игроков).

Шаг 3. Скрипт интерфейса (LocalScript в AdminPanel)

Вставьте код как дочерний LocalScript в AdminPanel:

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AdminActions = ReplicatedStorage:WaitForChild("AdminActions")
local GetPlayerList = ReplicatedStorage:WaitForChild("GetPlayerList")

local player = Players.LocalPlayer
local gui = script.Parent
local frame = gui.Frame
local playerNameBox = frame.PlayerNameBox
local playerList = frame.PlayerList

-- Функция отправки команды
local function sendCommand(action, target)
    AdminActions:FireServer(action, target)
end

-- Обновление списка игроков
local function updatePlayerList()
    playerList:ClearAllChildren()
    local players = GetPlayerNewtonList:InvokeServer()
    for _, plr in ipairs(players) do
        local label = Instance.new("TextLabel")
        label.Text = plr.Name
        label.Size = UDim2.new(1, 0, 0, 25)
        label.BackgroundTransparency = 1
        label.TextColor3 = Color3.new(1, 1, 1)
        label.Parent = playerList
    end
end

-- Обработчики кнопок
frame.KickButton.MouseButton1Click:Connect(function()
    sendCommand("kick", playerNameBox.Text)
end)

frame.BanButton.MouseButton1Click:Connect(function()
    sendCommand("ban", playerNameBox.Text)
end)

frame.HealButton.MouseButton1Click:Connect(function()
    sendCommand("heal", playerNameBox.Text)
end)

frame.TeleportButton.MouseButton1Click:Connect(function()
    sendCommand("teleport", playerNameBox.Text)
end)

frame.FlyButton.MouseButton1Click:Connect(function()
    sendCommand("fly", playerNameBox.Text)
end)

frame.GodModeButton.MouseButton1Click:Connect(function()
    sendCommand("godmode", playerNameBox.Text)
end)

frame.CloseButton.MouseButton1Click:Connect(function()
    frame.Visible = false
end)

-- Показ панели по клавише F9
player.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.F9 then
        frame.Visible = not frame.Visible
        if frame.Visible then
            updatePlayerList()
        end
    end
end)

Шаг 4. Серверный скрипт (Script в ServerScriptService)

Создайте скрипт в ServerScriptService и вставьте:

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AdminActions = ReplicatedStorage:WaitForChild("AdminActions")
local GetPlayerList = ReplicatedStorage:WaitForChild("GetPlayerList")

-- Список администраторов (замените на свои UserID)
local ADMINS = {12345678, 87654321}

-- Проверка прав
local function isAdmin(player)
    return table.find(ADMINS, player.UserId) ~= nil
end

-- Получение списка игроков
GetPlayerList.OnServerInvoke = function()
    local playerNames = {}
    for _, plr in ipairs(Players:GetPlayers()) do
        table.insert(playerNames, plr)
    end
    return playerNames
end

-- Обработка команд
AdminActions.OnServerEvent:Connect(function(player, action, targetName)
    if not isAdmin(player) then
        warn("Неавторизованный доступ: " .. player.Name)
        return
    end

    local target = Players:FindFirstChild(targetName)
    if not target then
        return
    end

    -- Выполнение действий
    if action == "kick" then
        target:Kick("Кикнут администратором " .. player.Name)
    elseif action == "ban" then
        -- Здесь можно добавить запись в DataStore
        target:Kick("Забанен администратором " .. player.Name)
    elseif action == "heal" then
        local character = target.Character
        if character then
            local humanoid = character:FindFirstChildOfClass("Humanoid")
            if humanoid then
                humanoid.Health = humanoid.MaxHealth
            end
        end
    elseif action == "teleport" then
        local character = target.Character
        if character and player.Character then
            character:SetPrimaryPartCFrame(player.Character:GetPivot())
        end
    elseif action == "fly" then
        -- Для полёта нужно создать BodyVelocity
        local character = target.Character
        if character then
            local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
            if humanoidRootPart then
                local bodyVelocity = Instance.new("BodyVelocity")
                bodyVelocity.Velocity = Vector3.new(0, 50, 0)
                bodyVelocity.Parent = humanoidRootPart
                game:GetService("Debris"):AddItem(bodyVelocity, 5) -- Удаляем через 5 с
            end
        end
    elseif action == "godmode" then
        local character = target.Character
        if character then
            local humanoid = character:FindFirstChildOfClass("Humanoid")
            if humanoid then
                humanoid.MaxHealth = math.huge
                humanoid.Health = math.huge
            end
        end
    end

    -- Логирование действий
    print(os.date("%X") .. " | " .. player.Name .. " выполнил " .. action .. " на " .. targetName)
end)

Шаг 5. Показ панели только админам

Добавьте ещё один скрипт в ServerScriptService:

123456789
local Players = game:GetService("Players")
local ADMINS = {12345678, 87654321} -- Те же ID, что и выше

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        if table.find(ADMINS, player.UserId) then
            -- Клонируем панель и отдаём игроку
            local adminPanel = game.StarterGui.AdminPanel:Clone()
            adminPanel.Parent = player

По дате
По рейтингу
Аватар пользователя
anonymousТролль
6мес
Изменено

звучит как скам

Аватар пользователя
cat_737363781Тролль
6мес

Какой скам? Это скрипт!



Видео по теме