#How to refer to parts within a model
1 messages · Page 1 of 1 (latest)
You can use getchildren()
Or something similar if that doesn't work
That will provide you a table of instances that are in the model
You can loop through each instance with that table
ModelName:GetChildren()
like this?
Is alternate2 a model?
Sort of yea
yes it is
But I would suggest making a variable for the model and a variable for the children you are obtaining
That way you have a table you can loop through
hello!, Is there anyone need help?
ya
Yes, this line is syntactically and functionally correct in Roblox Luau, assuming alternate2 is a valid Instance.
casually ignores the orange line where it says alternate2 is nil
Oh, alternate2 doesn't exist or hasn't loaded yet when the line runs.
replace it with this code :
local alternate2 = workspace:WaitForChild("Alternate2")
local switch = alternate2:GetChildren()**
what are the stars for?
and what does wait for child mean?
ik its kinda self explanitory but why do i need to wait for the child?
of that
It helps with runtime errors