local BanList = {}
if _______________ then --conditions or whatever type of system you're making when the player commits an offense or something and you want them to get banned
player:Kick()
table.insert(BanList, #BanList + 1, player.Name)
end
Sorry for the lack of indentation I just wrote up this concept real quick.
By using this, they shouldn’t be able to rejoin again.
If you used datastores and you wanted EVERY server to update it once the ban list gets updated, then it’d throttle real quick
The better option would be to use MessagingService and have a callback function for each server to update the BanList with Subscribe/PublishAsync whenever the BanList gets changed in one server.
Then, to avoid throttling you could probably have each server save on :BindToClose
Here, I wrote some code for you to expand on what I had started before:
local BanList = {}
local MessagingService = game:GetService("MessagingService")
local DataStoreService = game:GetService("DataStoreService")
function tablecontains(table, element) -- just a small function i wrote to see if a table contains a value in it
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end
game.Players.PlayerAdded:Connect(function(player) -- this checks to see whether a player that has joined is on the Ban List
for i, v in pairs(BanList) do
if v == player.Name then
player:Kick("You are banned from this game.")
end
end
end
)
MessagingService:SubscribeAsync(
"GameBanList",
function(name) -- this function updates the Ban List in every server when one server makes a change to it
table.insert(BanList, #BanList + 1, name.Data)
end
)
if _______________ then --conditions or whatever type of system you're making when the player commits an offense or something and you want them to get banned
player:Kick()
local result = tablecontains(BanList, player.Name) -- returns true or false
if not result then -- if it doesn't return true, it means that a player isn't in the ban list and we can add them to it
MessagingService:PublishAsync("GameBanList", player.Name) -- change the ban list and send a message to every other server so that they change it as well.
end
end
Correct me if I did anything wrong, plus indentation is weird on some parts cause I used a not-so-reliable beautifier and didn’t write this out in an actual script
Also, you’ll have to do the datastores yourself because I dont have the energy to just write the whole script for you
Why on earth would you do this. This is against the TOS. Or at least what you said in the title is. Just kick them if they are exploiting, and log their user ID and just kick them if they try to rejoin again. Phantom Forces does this if a user is vote kicked.