Answered by
4 years ago Edited 4 years ago
I'm really out of time, wrote this basic script which I am 100% will help, but basically, use only ONE key for the banned players, and also some code shortening using table.find
:
01 | local dss = game:GetService( "DataStoreService" ) |
02 | local http = game:GetService( "HttpService" ) |
03 | local banStore = dss:GetDataStore( "banStore" ) |
07 | game.Players.PlayerAdded:Connect( function (player) |
11 | banned = http:JSONDecode(banStore:GetAsync( "banned" )) |
17 | if table.find(banned,player.Name) then |
19 | player:Kick( "banned lol" ) |
27 | game.Players.PlayerRemoving:Connect( function (player) |
29 | banStore:SetAsync( "banned" ,http:JSONEncode(banned)) |
33 | local function ban(player) |
35 | table.insert(banned,#banned+ 1 ,player.Name) |
Hope this helped! (even though i didn't really explain anything) Edit: added a function so you know how to add banned players.