My simple ban script is not working

I have a datastore which saves a bool value to the player called “Banned” and what I want is that when it is set to false, the player is fine, but when it is set to true (when they have been banned) it will kick them every time they join the game.

Here is my current script (server script in serverscriptservice) I don’t know why it doesnt kick me when my value is set to ‘true’

game.Players.PlayerAdded:Connect(function(player)
	local banned = player:WaitForChild("Banned")
	if banned == true then
		player:Kick("You have been banned from the game.")
	end
end)
1 Like

you forgot to add a checker for the value
if banned.Value = true then
full script :

game.Players.PlayerAdded:Connect(function(player)
	local banned = player:WaitForChild("Banned")
	if banned.Value == true then
		player:Kick("You have been banned from the game.")
	end
end)
1 Like

ohh, my bad, silly mistake, Thank you!

no problem, i hope i helped charchar

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.