Tool "loses" it's children when cloned

For some reason, upon cloning a tool from a service where scripts don’t usually run to somewhere else where scripts actually run, the tool thinks all of it’s children are nil or simply does not exist?
using WaitForChild seems to fix this, but why is that?
Is it due to the script running faster than the instances cloning, basically a bug on roblox end or something else?

local __TOOL = script.Parent
local __USING = __TOOL.__USING


image

Script execution doesn’t yield for instancing, so when you call for something to be cloned, the script goes on immediately, likely much faster than an instance hierarchy can be created. It’s always safe to wait for a reference as there is otherwise no guarantee that an instance shows up before the script runs that bit of code.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.