How would i unban a player if they werent in the game?
Im trying to make a script so i can ban, kick, and unban players. But I'm not able to unban if the players arent in the game.
05 | local banlist = game:GetService( "DataStoreService" ):GetDataStore( "BanList" ) |
07 | game.Players.PlayerAdded:connect( function (player) |
08 | local playerId = player.UserId |
09 | local check = banlist:GetAsync(playerId) |
11 | banlist:SetAsync(playerId, "Clear" ) |
12 | elseif check = = "Banned" then |
13 | player:Kick( "You are banned from this game" ) |
14 | elseif check = = "Clear" then |
15 | print ( "You are clear!" ) |
18 | for i, admins in ipairs (admins) do |
19 | if player.Name = = admins then |
20 | player.Chatted:connect( function (msg) |
21 | for i,players in ipairs (game.Players:GetChildren()) do |
22 | if msg = = ":kick " ..players.Name then |
23 | players:Kick( "You have been kicked by: " ..player.Name) |
24 | elseif msg = = ":ban " ..players.Name then |
25 | banlist:SetAsync(players.UserId, "Banned" ) |
26 | players:Kick( "You have been banned by: " ..player.Name) |
28 | elseif msg = = ":unban " ..players.Name then |
29 | local pardonedId = game.Players:GetUserIdFromNameAsync(players.Name) |
30 | banlist:SetAsync(pardonedId, "Clear" ) |