For example, I have something similar to this in a localscript:
local value = game.Players.NumberValue.Value
But when I try manipulating it, like
function add() value = 0 value = value + player.Character.Torso:GetMass() end
The numbervalue doesn't change. The value variable changes, but the numbervalue doesn't. Any help would be appreciated.
The problem is with your function. You have no connection line, and you're not calling it. Also, you can't access the NumberValue's value directly like that.
local value = game.Players.NumberValue print(value)
Having the value set as this stores the value as a number. Not the object itself. This would print whatever the NumberValue's Value is, not the NumberValue. For example, if the NumberValue's Value was set at 5, this would print out "5" instead of "NumberValue".
For your script to work, we need it to be set as the object, which is "NumberValue". To fix this, try the script below:
local value = game.Players.NumberValue --Sets the object, instead of it's Value function add() value.Value = 0 --Accesses the NumberValue's Value. value.Value = value.Value + player.Character.Torso:GetMass() end add() --This is all you need to run the function, and the NumberValue's Value will change.
Anyways, this should work now. If you have any problems or questions, please leave a comment below. Hope I helped :P