Hi, I'm implementing a system where you can customize the colour of your gun. The RecolourValue is a BrickColorValue. It prints "1" and also prints "2", but does not print "3".
PrimaryMaterial = "Wood" for i,v in pairs(script.Parent:GetChildren()) do print '1' if v.ClassName == "Part" or v.ClassName == "WedgePart" then print '2' if v.Material == (PrimaryMaterial) then print '3' v.BrickColor = BrickColor.new(script.Parent.Parent.Parent.shopandinventoryvalues.RecolourValue.Value) end end end
Thanks for your help!
Your using material as a string value, they are not strings. It is a special data type that are different from the commonly used ones such as numbers, strings, bools, stuff like that. To fix this use:
Enum. --whatever the material u want is
Read the wiki if you need more help: http://wiki.roblox.com/index.php?title=Enumeration