Accessing script data from local script

But here’s the hierarchy, isn’t billboardGui in this case in script.parent.billboardGui? since I’m reaching the parent of the script and from there I access a child of that parent
image

No, its in script.parent.parent, if you’d use script.parent the billboardgui would have to be under the TowerScript

It worked, but I still don’t understand the referencing, if I do script.parent.parent I’ll be in the “Towers” folder and the only child to that path is the model that has no name, the billboardGui would be a descendant in this case isn’t that right? and when it’s a descendant I can’t access it using the dot operator like “.billboardGui”

Alright so let me try to explain, we start out by using Script, this refrences the TowerModule itself. When we add parent to that we refrence the TowerScript, so by using Script.Parent we can access every child of the TowerScript. When we add another Parent we have Script.Parent.Parent, using this we refrence the parent of the TowerScript, so the Model. Using this we can access every child of the model, since BillboardGui is a child of the model we have to use Script.Parent.Parent.BillboardGui

1 Like

Oh I forgot we were in the TowerModule while referencing the billboardGui, yeah that makes total sense, thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.