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

What is a child? Instance:FindFirstChild

Asked by 5 years ago

So i just got into scripting and i always see this type of command, but what really is a ''Child''? I can't find any good information that could explain it properly..

0
A child is something that is used to get any other objects inside an object. RoccoAttackYT 8 — 5y

1 answer

Log in to vote
2
Answered by
crywink 419 Moderation Voter
5 years ago

Hey,

FindFirstChild() will return the first child of an Instance.

So let's say my file tree looked like this...

Part
    - SurfaceLight

If I ran Part:FindFirstChild("SurfaceLight"), it would return SurfaceLight.

You can also use :FindFirstChild() in if statements to see if something exists or not like so...

if Part:FindFirstChild("SurfaceLight") then
    -- run code
end

If this helped, remember to accept and upvote the answer.

Ad

Answer this question