
Table.remove(bannedPlayers, Player.UserId) Table.insert(bannedPlayers, Player.UserId) Event code you wrote but you could alter your ban event and unban event to work with this data store by putting :Connect(function(Player : Player) :Connect(function(player)īanDataStore:SetAsync(playerUserId, data) Local success, errormessage = pcall(function()ĭata = BanDataStore:GetAsync(playerUserId, data) Local playerUserId = "Player_".player.UserId If you want to tie this in with a data store for some reason then you could do local DataStoreService = game:GetService("DataStoreService") Players.PlayerAdded:Connect(function(player) Include player IDs of people that you want banned For example, local Players = game:GetService("Players") Instead of saving boolean values to create a ban script you can just use a table of banned player ids and iterate through it. Player:Kick("You have been banned from this game!") Local result = BanDataStore:GetAsync(UserId) Local BanDataStore = DatastoreService:GetDataStore("BanDataStore") Local DatastoreService = game:GetService("DataStoreService") DatastoreHandler :Connect(function(player) :Connect(function(Player : Player)īanDataStore:SetAsync(Player.UserId, false) Print(tostring(Player.UserId)." has been banned!") :Connect(function(Player : Player)īanDataStore:SetAsync(Player.UserId, true)

Local BanDataStore = DataStoreService:GetDataStore("BanDataStore")

(I am only saving boolean values so it's not too much data!)īanHandler local DataStoreService = game:GetService("DataStoreService") If request queue fills, further requests will be dropped.Īnd any Datastore changes I try to make using scripts do not do anything. Basically I'm trying to make a banscript, but whenever I hit play on Roblox Studio it tells me the follwing: DataStore request was added to queue.
