So I want a script that colors the part in Model white.
Use:
on(Part)
The problem is that, it thinks that x is not an input, but a child of Model!
Screenshot:
I don’t know any solutios! So can you please help?
Code and error:
function on(x)
game.Workspace.Model.x.BrickColor=BrickColor.White()
end
--Error:
--20:33:49.893 x is not a valid member of Model "Workspace.Model" - Server - Script:10
When you index for x, it is attempting to index a child of the model named x – you would want to use square brackets [] for this to work correctly, since that would allow you to index with the inputted string.
function on(name) -- formery "x"
game.Workspace.Model[name].BrickColor = BrickColor.White()
end
If your “x” is a Part’s name and not an Instance and you use the solution above, be aware that in your case (Where you have 16 parts named the same, ‘0’) it will only change the color of one of them and most likely the top one in the explorer at that time.