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".
01 | PrimaryMaterial = "Wood" |
02 |
03 | for i,v in pairs (script.Parent:GetChildren()) do |
04 |
05 | print '1' |
06 |
07 | if v.ClassName = = "Part" or v.ClassName = = "WedgePart" then |
08 |
09 | print '2' |
10 |
11 | if v.Material = = (PrimaryMaterial) then |
12 |
13 | print '3' |
14 |
15 | v.BrickColor = BrickColor.new(script.Parent.Parent.Parent.shopandinventoryvalues.RecolourValue.Value) |
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