colorSecuense problem!

So Im trying to change my parts color in a script with a color sequens from an attribute can somehelp me

local color = game.ReplicatedStorage.Boxes:FindFirstChild(boxName):FindFirstChild(colorButtonName):GetAttribute("Color")

newButton.Color = Color3.new(color)
2 Likes

you don’t put the color variable into the Color3.new() method, you assign it directly to newButton.Color

1 Like

can you please show me how to do that im new to scripting

1 Like

Assuming the attribute is already a Color3, you don’t need to make another Color3. Color3.new() allows you to input 3 values (R,G,B). So just type

newButton.Color = color

Also, try not to string together so many methods, this is hard to read.

1 Like

Sure, if you’re using an attribute with the ColorSequence value as you say you are, then you can simply do this:

local color = game.ReplicatedStorage.Boxes:FindFirstChild("boxName"):FindFirstChild(colorButtonName):GetAttribute("Color")

newButton.Color = color

However this will only work with Beams, Trails and Particle Emitters. To do this with UI, you would need a UIGradient inside of the designated UI Object, then you would simply do the same thing as above but to the UIGradient. (UIGradient Documentation)

1 Like

I already tried that and got the error Unable to assign property Color. Color3 expected, got ColorSequence

1 Like

and the atribute is also a colorsequesnse not color if that exists

Then read the second part of what I posted, that should solve your problem.

1 Like

but its a part btw I cant get a ui gradient in there

That is currently impossible to do on roblox, however, you can simulate it using SurfaceGuis and Frames and UIGradients.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.