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

Why does the player not kick when the numbervalue changes?

So i'm making a script for when the number in the numberValue changes, the player gets kicked. Why does this not work?(Yes, i'm using a localscript)

local plr = game.Players.LocalPlayer
if script.NumberValue.Changed then
	plr:Kick('noob')
end

1 answer

✓ Accepted answer

You solved your own problem. You can't use the :Kick() instance via a LocalScript, rather a Script.

Also, you can't properly run script.NumberValue.Changed.

See code below:

local kickreason = 'numbervalue changed'

game.Players.PlayerAdded:Connect(function(player)
	script.NumberValue:GetPropertyChangedSignal('Value'):Connect(function()
		player:Kick(kickreason)
	end)
end)

1 comment

0

Also, if the number value is changed from the server, the change does not replicate to client. This is particular to value objects. It has to get the change from the same part it is made.

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