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

Why doesn't the text change in the GUI?

Asked by 10 years ago

I am having some problems with this. Can someone help me?

Text = script.Parent.Text



while wait() do
    print"Loaded"
    wait(5)
    Text = "News; Major updates to how the holo runs and looks."
    wait(7)
    Text = "Please listen to your trainer. Remember, HRs no AAing"
    wait(7)
    Text = "Wear the group uniform at all times. Buy the sub if you cannot afford it"
    wait(7)
    Text = "Nothing can be done without team work. Remember that"
    wait(2)
    print"Finished"
end

1 answer

Log in to vote
2
Answered by
Ekkoh 635 Moderation Voter
10 years ago

When you set the Text variable, you're essentially storing a copy of what the text was at the time the script ran. You basically did this.

Text = "TextLabel"

while wait() do
    print"Loaded"
    wait(5)
    Text = "News; Major updates to how the holo runs and looks."
    wait(7)
    Text = "Please listen to your trainer. Remember, HRs no AAing"
    wait(7)
    Text = "Wear the group uniform at all times. Buy the sub if you cannot afford it"
    wait(7)
    Text = "Nothing can be done without team work. Remember that"
    wait(2)
    print"Finished"
end

You're changing the value of the variable now, but it's not actually changing the text. You do in fact have to type .Text to change the Text property of a GUI. However, you could still have a variable for the GUI itself.

label = script.Parent

while wait() do
    print"Loaded"
    wait(5)
    label.Text = "News; Major updates to how the holo runs and looks."
    wait(7)
    label.Text = "Please listen to your trainer. Remember, HRs no AAing"
    wait(7)
    label.Text = "Wear the group uniform at all times. Buy the sub if you cannot afford it"
    wait(7)
    label.Text = "Nothing can be done without team work. Remember that"
    wait(2)
    print"Finished"
end
0
Thank you! adspace44 20 — 10y
Ad

Answer this question