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

Help me with the changed event? [STILL NEED HELP]

Asked by 10 years ago

Hey guys! I'm simply trying to check every second to see if a numberValue ("Amount") has changed, and if it has, then change a textLabel's text to the value of the numberValue. I tried this

while true do
    wait(1)
    if script.Parent.Parent.Amount.Changed then
        script.Parent.Text = script.Parent.Parent.Amount.Value
    end
end

Please help me ASAP. It is important because I want to get my new game out by New Years :)

2 answers

Log in to vote
0
Answered by 10 years ago
v = script.Parent.Parent.Amount
while wait() do
script.Parent.Text = (v.Value)
end

I do this all the time

Ad
Log in to vote
0
Answered by 10 years ago

Try using the method instead, what you are trying to do is wrong. Try to the following code below.

amount = script.Parent.Parent.Amount

amount.Changed:connect(function ()
    script.Parent.Text = amount.Value
end)

This allows for easier scripting and doesn't use the wait thread. The function fires every time anything in the amount changes. Hope this helps :D

0
It didn't quite work. Could you please review your answer? I will check back in the morning :) SchonATL 15 — 10y
0
Try changing the variables meaning the amount variable to it's actual location and the text variable. legobuildermaster 220 — 10y
0
This script should work perfectly fine. Shawnyg 4330 — 10y

Answer this question