If I clone an object that has a child in it, should I use WaitForChild to get it or a dot operator?
For example:
local Object = game.Workspace.Something:Clone()
Object:WaitForChild("ChildObject")?
or
Object.ChildObject?
If I clone an object that has a child in it, should I use WaitForChild to get it or a dot operator?
For example:
local Object = game.Workspace.Something:Clone()
Object:WaitForChild("ChildObject")?
or
Object.ChildObject?
You should use WaitForChild()
to properly confirm that something truly exists, if the child is already inside the object you could just use the dot operator I’d assume
It entirely depends on your use case, but do keep in mind that cloning objects will automatically set its Parent
to “nil”
local Object = workspace.Something:Clone()
print(Object.ChildObject) --Would either print back the ChildObject or nil if it's not there
Ok, thanks! Just wanted to make sure I was doing it right.