Value isn't changing from what it currently is!? Please Help

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I have a script that cahnges a players value when a part is clicked. The value does incease by one when the part is clicked, however when I change the value either manually or by script, and then click the part, the value does not increase from the current value but from what the value was before I changed it.

  2. What is the issue? Include screenshots / videos if possible!
    Here is a video:

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I feel like I’m going insane because I have no idea why this is happening.

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	
	player.Wood.Value += 1
	
end)

Check the server and client view in studio, I believe you are changing from the client view only which does not replicate to the server.

See the testing modes for more info:

verify that the part is recieving clicks by printing something

Look at the output, that is where I show the current value. It is getting updated there

this
ffffffffffffffffffffffffffffff

I’m pretty sure you are right, because when I was trying to update the value, it was through a localscript. I changed between server and client and saw what you meant. Would the only way I could update the value from local script is to use remote events?

you could just use a server-side script, right?
what do you want to do that sets the wood value to 0?

Yes, but the wood must be changed from localscript because it is apart of a script that uses userinputservice. (I’m making an inventory system and when the player right clicks it drops the item and the wood value is changed to 0)

Yes values are properties which require remote events to replicate.

However you can note there are exceptions such as physics and animations. You can read more on the docs or dev hub.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.