I'm a bit of a beginner to scripting and I wanted to make a plugin that changes selected objects from plastic to smoothplastic.
if Obj.Material == "Plastic" and Obj.ClassName == "Part" or Obj.ClassName == "WedgePart" or Obj.ClassName == "CornerWedgePart" or Obj.ClassName == "UnionOperation" or Obj.ClassName == "TrussPart" or Obj.ClassName == "SpawnLocation" then Obj.Material = "SmoothPlastic" end
For some reason when i selected a plastic part and activated it the material stayed the same. However when I used a WedgePart it changed to smoothplastic, but it would still change to smooth plastic even when it wasn't plastic. This question probably will make you professional script builders cringe, but i can't figure out how to make this work.
IsA
. This will return true if the object inherits from specified class. Also, it doesn't work because Material
is an enum, not a string.if Obj.Material == Enum.Material.Plastic and Obj:IsA("BasePart") then