After player gets banned, they can rejoin with no kick

Hello, I am trying to write up a ban system, everything works except for the fact that when the player rejoins they DO NOT GET kicked (the ban logic works)

Script:

Players.PlayerAdded:Connect(function(Player)
	print(Player.Name .. " has landed!")
	if checkIfBanned(Player.UserId, true) then return Player:Kick("You have been banned from this game!") 
end

Banned function (i am using this datastore):

local function checkIfBanned(playerId, playerInfo)
	for id, info in pairs(BannedStore:GetAllSavedAsync()) do
		if id == tostring(playerId) and playerInfo == info then
			return true
		end
	end
	return false
end

This is how to ban a player:

BannedStore:SetAsync(PlayerId, true)

Any help would be appreciated, thanks!

why dont you use the already built in ban system?

2 Likes