Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The gui that is inside this script won't appear any suggestion?

Asked by 3 years ago

local version = 25 local banStorage = game.DataStoreService:GetDataStore("Ban Storage v"..version)

local admins = { ["My Name"] = 1; }

game.Players.PlayerAdded:Connect(function(player) if admins[player.Name] then local clone = script["Admin Panel"]:Clone() clone.Parent = player.PlayerGui end

local previousData = banStorage:GetAsync(player.UserId)

if previousData == nil then
    -- They don't have any data.

    banStorage:SetAsync(player.UserId, false)
    -- false is equal to not banned
    -- true is equal to banned
else
    if previousData == true then
        -- They are banned.

        player:Kick("You are banned.")
    else
        print("Player is not banned!")
    end
end

end)

game.ReplicatedStorage.Ban.OnServerEvent:Connect(function(player, victim) if admins[player.Name] then -- If they are an admin.

    local found = game.Players:FindFirstChild(victim)

    if found then
        banStorage:SetAsync(player.UserId, true)
        found:Kick("You have been banned.")
    end
end

end)

Answer this question