local circle = script.Parent local players = game:GetService("Players") local DataStoreService = game:GetService("DataStoreService") local bannedStore = DataStoreService:GetDataStore("BannedPlayers") local function getBan(player) if bannedStore:GetAsync(player.UserId) then return true end return false end local function checkBan(player) if getBan(player) then player:Kick("Please do not come back as you failed.") end end local function CircleExtending() circle.Size += Vector3.new(0,5,5) end local function CircleShrinking(player) circle.Size -= Vector3.new(0,50,50) bannedStore:SetAsync(player.UserId, true) player:Kick("You have failed this event, thank you for attending.") end local function onPlayerAdded(player) player.CharacterAdded:Connect(function () CircleExtending() checkBan(player) end) player.CharacterRemoving:Connect(function () CircleShrinking(player) end) player.PlayerRemoving:Connect(function () CircleShrinking(player) end) end players.PlayerAdded:Connect(onPlayerAdded)
I try running bannedStore:RemoveAsync(my id) but it says 'attempt to index nil' I know it can't be nil because It kicks me when I join, my friend is also banned and I cannot remove him too
This function seems to be banning and kicking everyone regardless.
local function CircleShrinking(player) circle.Size -= Vector3.new(0,50,50) bannedStore:SetAsync(player.UserId, true) --Ban player:Kick("You have failed this event, thank you for attending.") --Kick end
You call this function whenever a client's character is removed or when the player leaves the game effectively banning everyone after their first play of your game. Change this to stop everyone from being banned
player.CharacterRemoving:Connect(function () CircleShrinking(player) end) player.PlayerRemoving:Connect(function () CircleShrinking(player) end)
For unbanning yourself and your friends I recommend using :RemoveAsync() or doing a manual :SetAsync(UserId,false)