Hey, I was just wondering how to make an if statement for physical properties, like the part material or color.
if script.Parent.Parent.Door.Material == "Neon" then
script.Parent.Material = "Neon"
end
Hey, I was just wondering how to make an if statement for physical properties, like the part material or color.
if script.Parent.Parent.Door.Material == "Neon" then
script.Parent.Material = "Neon"
end
Material values are Enums, not strings. You should check the Enum. You can still set the value with a string for convenience, though.
if script.Parent.Parent.Door.Material == Enum.Material.Neon then
script.Parent.Material = "Neon"
end
It doesn't seem to be working. The door has a script that changes its material when touched, and this should make the egg light up also, but for some reason, it does not do this, it only lights up the door.
This is the correct answer. If you have a problem in your script context, then ask a better question.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
What you said is a correct way to see if 'script.Parent' has material of 'Neon', is this not what you want? Pretty similar for all other properties.
I've tried this previously, it doesn't seem to work.
Oh just noticed that wasn't the script I was using, let me fix it.