Say that in my ROBLOX Studio Explorer Window I see the following:
Note: This was formatted in the form of a script to make visible the paths of Parents and Children
All or these are descendants of the "game". Things on this directory like "Workspace" and "Players" are direct children of "game". It is like one big family. "Workspace" is the child of "game", and "Terrain" is the child of "Workspace". Your building parts and your scripts will usually be in the "Workspace" family as you can see with the brick named "YourBasePlate". If you wanted to make a button brick, you could have your "ButtonBrick" in the family of "Workspace", and have a script to activate in the family of "ButtonBrick". You might make a button script like the following:
2 | brick.Touched:connect( function (part) |
3 | print ( "I've been touched!" ) |
In the first line, the variable "button" is defined. It tells the script that "button" is the script's Parent, which in this case happens to be "ButtonBrick". The second line tells the script that if the brick is touched, trigger the function. If the function is triggered, the script will print "I've been touched!" to the output window in ROBLOX Studio. The final line closes the function, and thus finishes off the event.
tl;dr:
Parents and Children act like a big family tree. You can refer to the Parent of an object with the ".Parent", or even go further up the hierarchy with something like "script.Parent.Parent". Parents and Children just are the way of organizing objects and services in the "game" directory.
Locked by SanityMan and TheMyrco
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?