✓ Accepted answer
The problem is that you only change the value once. To fix this, move line 5 to be inside the loop:
local wood = sp:WaitForChild("WoodValue")
local woodvalue = wood:WaitForChild("Value")
if wood and woodvalue then
while true do
woodvalue.Value = woodvalue.Value + 1
wood.Text = woodvalue.Value
wait(0.1)
end
end
However, if this not the only place woodvalue gets updated, it would be better to use the Changed event, like this:
local wood = sp:WaitForChild("WoodValue")
local woodvalue = wood:WaitForChild("Value")
if wood and woodvalue then
woodvalue.Changed:connect(function()
wood.Text = woodvalue.Value
end)
while true do
woodvalue.Value = woodvalue.Value + 1
wait(0.1)
end
end
1 comment
Thanks, it worked.