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)
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)