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

Why do i have to do multiple parents for TextLabel?

Asked by 4 years ago

Hello! As the very confusing title may suggest i do not understand why i for example have to do

script.Parent.Parent.TextLabel.Text 

whilst in all of the tutorials that include a TextLabel it shows up as

script.Parent.TextLabel.Text

So i figured something might be wrong in my settings or there has just been an update with Lua since those videos were made but neither of those lines work when i put them into my script I've followed the exact tutorial and re-watched them 3 times to see if i did something wrong but i keep getting stuck at the same part which is that part and i don't see as to why they only need |script.Parent.TextLabel.Text| whilst i need |script.Parent.Parent.TextLabel.Text| or that its just a dumb mistake im making. thanks for the help!

1 answer

Log in to vote
0
Answered by 4 years ago

The parent of something is what that thing sits inside of. For example, if you put a part inside of workspace, workspace is the parent of that part. Something can have multiple parents above it if something like this happens: Lets say I put a part in workspace, then I put another part in that part, then I put another part in that part. The part at the bottom will have lots of parents above it. Its kind of like putting folders inside folders. When you say, "Script.Parent.TextLabel.Text," the script's parent is most likely a frame. When you say, "Scripts.Parent.Parent.TextLabel.Text," the script's parent is most likely another textlabel or something like that. What I would recommend doing is going through your StarterGui, or where ever your textlabel and the other stuff is located, and seeing where everything is and try fix the script. I cant tell you exactly whats wrong because I cant see your roblox studio. Aanyway, even if I was not able to help you, remember, don't give up, keep scripting, and have fun!

Ad

Answer this question