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

Simple gui text changing script, why won't it register a change?

Asked by 5 years ago
local changeText = script.Parent
local waitTime = 0.1

while true do
    changeText.Text = (">CONFIRM")
    wait(waitTime)
    changeText.Text = ("CONFIRM")
    print("Text has recently been run through a change.")
end

It's not registering a change. I'm not sure why even though the script is running and it changes once, after that it doesn't change anymore. What the hell is going on here?

Here's the freemodel w/the Gui so that you can see for yourself: click here to see!

Tell me, what's up w/this?

0
How many times does the code print? Thundermaker300 554 — 5y

1 answer

Log in to vote
4
Answered by
mattscy 3725 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

This is occuring simply because there is no wait after the second time you change the text. As a result, it instantly starts the loop again, changing it back to the first text, and appearing as if it never changed to the second. To fix this, simply add another wait:

local changeText = script.Parent
local waitTime = 0.1

while true do
    changeText.Text = (">CONFIRM")
    wait(waitTime)
    changeText.Text = ("CONFIRM")
    wait(waitTime)
    print("Text has recently been run through a change.")
end
0
Thank you so much. It appears this is the reason! Arithmeticity 167 — 5y
Ad

Answer this question