Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Add To Value Of Int Value That's Divided? [EDITED]

Asked by 8 years ago
Edited 8 years ago

So this script won't work and idk why. It prints everything, but it doesn't add to the IntValue. It's suppose to add 'number of chickens multiplied by(*) 0.25' to the 'money value' but it doesnt. What am I doing wrong??

Works! :D New Script:

while true do
    local waitTime = script.Parent.WaitTime.Value
    local money = script.Parent.Parent.Money
    local chickens = script.Parent.Parent.Chickens  
    print('1')
    wait(waitTime)
    print('2')
    money.Value = money.Value + (chickens.Value*0.25)
end

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Well, it seems to me like neither money nor chickens is ever updated in this script, which means it will remain the default value forever. Just move all of the variables into the loop and it should work fine. Just make sure to declare your variables before you use them.

Ad

Answer this question