Should I use :FindFirstChild() as much as possible?

I’m not sure whether I should use :FindFirstChild() for every instance. For example, should I constantly use :FindFirstChild() if I’m just trying to find things that already exist, or things that I 100% know exist?

I mean you could use it if you want but I don’t really think you do because if you know it will always be in the same place and will not move then you should have not many issues.

I mainly use :FindFirstChild() when I am checking to see if a instance is somewhere

E.g:

local player = game.players:FindFirstChild(“PlayerName”)
if player then
print(“Code here”)
end

FindFirstChild takes 20% longer than the dot operator and takes 8x longer than having a reference to the object in memory. If you know the object will be there all the time, do not use FindFirstChild.

4 Likes

:FindFirstChild() is good if you want to find something from another name, for example a player’s name. I usually use :WaitForChild() for some reason so if the object hasn’t loaded yet it will wait for it to load.