I have been making a Gui that can be used to change the material and color of a selected brick. so far,the material and selection systems work perfectly, but the color system is not working due to some trouble with color3 values. here is the code so far:
script.Parent.MouseButton1Click:connect(function() bases=script.Parent.Parent.Parent.BaseColors:GetChildren() number=string.match(script.Parent.Name,"%d") color=bases[tonumber(number)].Value--last 3 lines find the value containing the color3value print(color.r/255,color.g/255,color.b/255)--prints 0.0013071895814409 0.003921568627451 0 for 85, 255, 0 script.Parent.Parent.Parent.Parent.Parent.SelectedItem.Value.BrickColor=BrickColor.new(color.r/255,color.g/255,color.b/255)--tries to set the color of the selected part to the selected color, --but it will set it to the output mentioned above end)
any ideas guys? thanks in advance!
You can set the part's color with Color3 as well, it will just automatically find the closest preset color from BrickColors.
script.Parent.MouseButton1Click:connect(function() bases = script.Parent.Parent.Parent.BaseColors:GetChildren() number = string.match(script.Parent.Name,"%d") color = bases[tonumber(number)].Value print(color.r/255,color.g/255,color.b/255) script.Parent.Parent.Parent.Parent.Parent.SelectedItem.Value.Color = Color3.new( color.r/255, color.g/255, color.b/255 ) end)
Edit: Fixed the color systems