✓ Accepted answer
BrickColor is an Object since it contains methods, attributes, and more. Whereas Material is no more than a textual identifier that describes a to-be-used texture. It is not an Object, therefore lacks a constructor function.
By taking a quick look at the documentation of Material, you'd notice it's an Enum. You can use that to appropriately assign the property:
BasePart.Material = Enum.Material.
One last thing to mention: your loop has no yield, which, if you're fortunate, will cause a script-timeout. Make sure to include a wait() somewhere in its scope.
####NOTE:
You allocated the StringValues' values, which will actually store the state at which it was at runtime. You aren't creating a pointer to the property, nor can you ever. You'll need to index .Value every time you wish to see its current state.
There is a much more efficient way of updating your property. Use the :GetPropertyChangedSignal() method of the Instance base-class. This will generate an RBXScriptSignal that you may bind a Callback to upon the suggested property's adjustment:
local DropperModel = script.Parent
local DropPartTemplate = DropperModel.Part
local DropMaterial = DropperModel.DropMaterial
local DropColor = DropperModel.DropColor
DropMaterial:GetPropertyChangedSignal("Value"):Connect(function()
DropPartTemplate.Material = Enum.Material[DropMaterial.Value]
end)
DropColor:GetPropertyChangedSignal("Value"):Connect(function()
DropPartTemplate.BrickColor = BrickColor.new(DropColor.Value)
end)
3 comments
*colour
I'm not trying to do something not there I just wanted to make it so I could change a String Value attached to the dropper and it would change the material.
oh, I don't think that Material.new is a thing.