I'm new to Lua and hoping to become really good at it in the future. I'm wondering if WaitForChild creates a new variable or refers to one?

2 comments

0

both. Depends on how you use it. x = workspace:WaitForChild('item'), if workspace:WaitForChild('item') then end

0

WaitForChild returns the Instance specified, with the added functionality of yielding until it exists; complications can arise, and this method of Instance should be used only when necessary. You can optionally allocate this into a varaible.