Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
v = script.Parent.Parent.Amount
while wait() do
script.Parent.Text = (v.Value)
end

I do this all the time

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

3 comments

0

It didn't quite work. Could you please review your answer? I will check back in the morning :)

0

Try changing the variables meaning the amount variable to it's actual location and the text variable.

0

This script should work perfectly fine.

This discussion is preserved as it was. New answers, comments, and votes are closed.