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)