[Solved] How to change color of spring constraint with code?

Hello everybody!

I want to change my spring to a different color. I get the following error:
Unable to assign property Color. BrickColor expected, got Color3
Is there just no way to have my springs not adhere to the preset list of named colors? If so, that’s very lame -_-

In case it wasn’t clear, I’m asking how do I change my springs to a color that’s not listed on the BrickColors list.

Thanks!

simply change the color instead of the brick color

workspace.Color = Color3.new(255, 255, 255)

workspace.Baseplate.BrickColor = BrickColor.White()

finallyunderstand

Read the second and third line of my original post…

image

i just now realized you’re changing a spring constraint not a part. you can create your own brick color doing BrickColor.new()

Might be wrong, but I don’t think it’s possible to define it as a colour that isn’t a BrickColor (unfortunately).

It comes from its parent class type, Constraint, as you can see, the ‘Color’ property is a ‘BrickColor’, not a ‘Color3’ which is what you’d be after.

Saying that though, as @BonesIsUseless says, you could do a BrickColor.new(), looks like it has r, g and b arguments you can provide. https://create.roblox.com/docs/reference/engine/datatypes/BrickColor, I believe it rounds it to the nearest BrickColor though.

correct, but it rounds it to the nearest preset brick color (or so it seems in my limited testing)

image
Input: 0.499, 0.730, 0.860
Output: 0.501961, 0.733333, 0.858824

image
Input: 0.503, 0.736, 0.855
Output: 0.501961, 0.733333, 0.858824

i forgot it does this :man_facepalming:

the closest you can get is using an attribute or color value

no worries :sweat_smile:

may you elaborate on “attribute or color value”?

It is impossible to set it to the exact color you want.
You can only set it to one of the colors defined here.

If you try to set it to an undefined color, it will round to the nearest defined color.

Yep, pretty much what I’ve gathered. Thanks everyone! :heart:

what i meant was if you really needed to read an exact color value from the spring constraint for whatever reason (maybe customization), the closest alternative is a color value or an attribute.

the physical color must be a preset brick color like @FauconFR_01 said
this would be a good feature request :thinking:

hey don’t mean to bother you but you should click on the “Solution” button on the answer that solved your issue instead of adding the “[Solved]” prefix in the title.

Thanks!

@xmthl definitely said it first