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?
COMMUNITY QUESTION
Does "WaitForChild" create a new variable or refer to a variable?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
both. Depends on how you use it. x = workspace:WaitForChild('item'), if workspace:WaitForChild('item') then end
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.