Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I kick a player once they have 0 points?

I am making a 'limited words' based game, and trying to kick a player when they have 0 points. For some reason, it wont work. Can anyone help? Here is the script;

game.Players.PlayerAdded:Connect(function(player)
	if player.leaderstats.Points.Value <= 0 then
		player:Kick("You ran out of points!")
	end
end)

1 answer

✓ Accepted answer

Your current code only checks if the player’s point is 0 once when they just joined. Instead try checking every time their point changes.

local Players = game:GetService('Players')

Players.PlayerAdded:Connect(function(player)
	local pointsValue = player.leaderstats.Points
	
	pointsValue.Changed:Connect(function()
		if pointsValue.Value <= 0 then
			player:Kick('You ran out of points!')
		end
	end)
end)

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.