Unable to change the part colour by string value

Well, I want to write a script to change the brick colour by random string values. However, the script is not working…



To get the actual value of the value object, you need to write script.ValueObject.Value. script.ValueObject will just get the value object itself, throwing the “…expected Color3, got Instance” errors you are receiving.

Also, please paste and format your code into the post instead of sending images; it makes it a lot easier to read, and sometimes the images won’t load. You can do this by pasting the code into the post and adding ``` before and after,

Like
this
1 Like

Still got error
Unable to assign property Color. Color3 expected, got string - Client - LocalScript:174

If you print out the value of Set1Floor3.Script.Value.Value, what does it output?

1 Like

Nothing

Where are you trying to set the value of it?

1 Like

Im assuming your trying to set the color of a part?

script.Parent.Color = Color3.new() -- put the color inside the brackets
1 Like

It wants a color3 value not a string … show us a print of the sting you’re looking to set to a color.

1 Like

a part

Remove the quotation marks, should work

Edit: Hang on im confused on what youre trying to do

2 Likes

Well there is your problem … you’re making it a string and you actually already have it set up to be a color3 … just remove the ""s

1 Like

Use a Color3Value instead of a string value and remove the quotation marks
image

2 Likes

I just found out what you wanted to do, remove the quotation marks, and use a Color3Value instead

2 Likes

There you go … hope that works for ya.
Do what PoppyandNeivaarecute is saying too.

Suggest using Color3.fromRGB(211, 33, 255) … the numbers go from 0 to 255 … Red, Green, Blue

Makes it very easy to work with.
You can just look at that and see that is a purple color … it is also a universal way of calling a color.
Most every language will use that format.

1 Like

If you’re new, I’d recommend starting with .BrickColor instead.

example,
workspace.Part.BrickColor = BrickColor.new(“Pastel Blue”)
which yes you can pass a string in brickcolor.new

It also has cool functions like BrickColor.random()

Read more about brick color here,

The floor changed its colour but the UI didn’t…
and there are still errors


Instead of BrickColor.new(), you should use Color3.new()

Make sure you changed the StringValue object to a Color3Value, where applicable.