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
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
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
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.