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

Help With a Simple yet Complicated Script?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So I want to change a textlabel's text more than once in a startergui, but when I change it more than once it stays with the first change, please help me.

local textlabel = script.Parent.Parent.StarterGui.ScreenGui.intercom

while true do
    textlabel.Text = "hi"
    wait(1)
    textlabel.Text = "lol"
    wait(1)
    textlabel.Text = "gg noob"
    wait(1)
end
0
>.> Dude, you are changing STARTER. Not the player's. fireboltofdeath 635 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Add this inside the text label


while true do script.Parent.Text = "hi" wait(1) script.Parent.Text = "lol" wait(1) script.Parent.Text = "gg noob" wait(1) end

You were trying to change the STarterGui, which means it would stay as was on players but for new players it is the next text, but again doesn't change until new player or respawn. So if you add this script into the textlabel it will use script.Parent.Text to change it without a super long link.

Ad
Log in to vote
0
Answered by
funyun 958 Moderation Voter
8 years ago

StarterGui is a special folder that copies its contents to each player's PlayerGui. We do not edit the StarterGui folder, but rather write our script as if the Gui is already in the player's PlayerGui, like this. As you can see, when the game ran, the ScreenGui that was in StarterGui was copied and sent to my PlayerGui. So, we place our ScreenGui in StarterGui, and edit our LOCAL! script like so:

--LocalScript, NOT just a Script. All ScreenGuis run on LocalScripts.

local textlabel = script.Parent.intercom --Wherever the intercom is located in your GUI

while true do
    script.Parent.Text = "hi"
    wait(1)
    script.Parent.Text = "lol"
    wait(1)
   script.Parent.Text = "gg noob"
    wait(1)
end
0
My bad. Replace script.Parent with textlabel. funyun 958 — 8y
0
Thats nice and all but what if I want the change in the text in such a way that the the change can trigger a function or event? killerorca1209 0 — 8y

Answer this question