Function in module script doesn't add values

  1. What do you want to achieve? Keep it simple and clear!
    i want to add 2 values in a function (that is in a module script)

  2. What is the issue? Include screenshots / videos if possible!
    image
    it just doesn’t add the values together
    printing cashamount and cash shows the correct values for both

(the image of the script that calls this function)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    replacing cash = cash + cashamount with cash += cashamount
    adding wait() after the addition

When updating a ValueBase, do not store the ValueBase with .Value; you’re not saving a reference to the property, you’re just storing the current value of the property.

Just save the ValueBase Instance to a variable and update the Value property from there.

ValueBase.Value += amount 
3 Likes

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