Difference between :FindFirstChild("") and .blah

I looked at the dev hub and couldn’t really find an answer,

--I understand the difference between

local blah = blah:WaitForChild("blah") -- yields for the child
local blah = blah:FindFirstChild("blah")

-- yet whats the difference between these two, are they synonymous? is it that :FindFirstChild when errors returns nil where .blah just errors?
local blah = blah:FindFirstChild("blah")
local blah = blah.blah 

FindFirstChild will return the object if it exists (true), or false if it doesn’t
Using .blah will cause an error if the object does not exist.

This is especially important if you’re using a parameter inside a function where you might want to check something exists before doing anything.

e.g

function BuyItem(item)
  if ItemFolder:FindFirstChild(item) then
    -- do something
  else
      print("Requested item does not exist")
  end
end
2 Likes

thanks thats what i thought but its nice to have confirmation

2 Likes