I have tried many things. My Text Label is in a Frame inside of the StarterGui. My code looks like this:
wait(3) game.StarterGui.ScreenGui.Frame.TextLabel.Text = "But it was me, Dio!" end)
Can someone tell me what's wrong with it or provide a new code that I can copy an put in my game.
Thanks in advance, San
Because your changing the text from the StarterGui You need to access the player gui which can only be done in a local script.
Please go to the wiki or youtube to learn more about the PlayerGui Hope this helps!
Well, first, you can only change GUI with Localscript, and second, the StarterGui is not where the player's GUI is. It acts like the StarterPack. It's just what gets put there when you spawn in, but you can't interact with it as if it was the player's.
If this is supposed to change by an event/function, read up on Remote Functions and Events. https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
--this is a localscript inside of that frame. script.Parent.TextLabel.Text = "But it was me, Dio!" --here, we affecting the player's GUI, which is in the "PlayerGui" inside the player.
I'm sorry if this is explained weird, please leave a comment if you need more explaining.
Upvote and accept the answer if it worked
First of all, you can not access the StarterGui
through script as it gets later changed to PlayerGui
as you join in game. ROBLOX just decided to do it this way, which is one of the most common mistakes in beginner scripting. Even I got frustrated, but, it's not as hard as you think.
Firstly, insert a LocalScript
inside your TextLabel
.
Secondly, open it up, and start typing your wait(3)
function.
Thirdly, type in your script.Parent
line, which is your line of code, if you don't understand, just type this.
script.Parent.Text = "But it was me, Dio!" -- Also I can sense your game is a drama game? Correct me if I'm wrong xD
Okay so now that we have finished that, I get confused on why you added an end)
. If you're using that end)
for the wait loop, remove it. If you're using it for a function of code in a function, let me know, as I'm struggling to find out why you have added an end)
?
Okay, hopefully this helped, let me know if it has, thanks!