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)
