Okay, so basically im tryna make a serverban script for vip servers and moderators, but I’m wondering if its possible to use tables for server bans. I honestly never tested it, so I really wanna know if it’s possible or not, and if it’s reliable or not.
Its possible also save the table on data store service you could also access the table if ever you want to check who are the banned players, you can also remove them:
Edit: Now that I think about it you can just store it on the player:
defaultData = {
{...} -- other things like money, inventory, etc.
BanData = {
IsBan = false,
UntilBanned = 0
}
}
This is how server-bans work. The player list doesn’t save, it’s only a list stored in the server.
I suggest you make the table global so you can access it from several scripts. E.g.:
_G.ServerBanList = {}
game:GetService("ReplicatedStorage").AddBanEvent:Connect(function(player, targetID)
if player.UserId == 000000 then
table.insert(_G.ServerBanList, tonumber(targetID))
else
print("Player is not a moderator")
end
end)
And you can check the list with a loop:
game:GetService("Players").PlayerAdded:Connect(function(player)
for index, value in pairs(_G.ServerBanList) do
if player.UserId == value then
player:Kick("Server banned.")
end
end
end)
Once the server shuts down, the list will be obviously lost.