Color Attribute Bug

Hello,

I’ve been trying to change a part’s color using attributes, however it turns out black despite the assigned attribute. Any help would be appreciated. Thanks!

image

local color1 = script.Parent:GetAttribute("color1")
p.Color = Color3.new(color1)
-- not blue, turns black

I’m pretty sure the Attribute is already a Color3
Try this:

local color1 = script.Parent:GetAttribute("color1")
p.Color = color1
-- not blue, turns black
1 Like

It seems like color3 doesn’t want to do that either

local color1 = script:GetAttribute("color1") --color1 is an attribute of the script itself
p.Color = color1
1 Like

color1 is an attribute of the script. This means when you try to get the color1 attribute of the part, it returns nil, which becomes black because you’re basically running Color3.new(nil) which is the same as Color3.new(). You should change your code to

script:GetAttribute("color1")

or add the color1 attribute to the part instead of the script.

2 Likes