Need help with this script

I know this question is VERY basic but this is my problem:

I was trying to change the color of a part by using the data contained in a Color3 value
for example a Color3value that stores (1,0,0)

But when I type in the comand bar:

local part = workspace.Party
part.Color = Color3.new(workspace.ColorValue.Value)
print(workspace.ColorValue.Value)
print(part.Color)

It prints that the color3value in stored in the Value is = (1,0,0) but the part has’nt changed its color at all, and part.Color is the same as before.

Any Ideas ?

The code seems to make sense, but you may have something behind the scenes going on that you may not realize?

Are you using a LocalScript? If you are, you may have to use RemoteEvents because a LocalScript runs on the client, and ROBLOX doesn’t allow the client to directly make changes to the server.

I’ll try to search for some background problems and all that stuffie and Im using a script in server script service.

I would give this a shot, use color3:fromRGB()

I’ve tested your script myself, and it seems to be working.

Did you use the correct Value type (Color3Value)?

Instance.new(“Color3Value”)

1 Like

I don’t play with Color3Value a lot, but if you do this, it should work:

local part = workspace.Party
local colorValue = workspace.ColorValue.Value

part.Color = Color3.new(colorValue.R, colorValue.G, colorValue.B)

Now, whenever you change the Color3Value, the part’s color should also change.

When you print colorValue, it takes the value in Color3Value and divides it by 255. So, if I had an RGB value in the Color3Value of

156, 0, 2

The output if I printed colorValue

 0.611765, 0, 0.00784314

I am actually not sure why this happens, and if anyone who knows wants to tell me, please do.

1 Like

Just do part.Color = workspace.ColorValue.Color. You’re overcomplicating it by trying to put a Color3 inside the Color3 constructor.

Edit:

This is redundant. You’re just doing part.Color = workspace.ColorValue.Color in a more complicated (and less efficient) way. This is the equivalent to x = tonumber(5) or part.Color = Color3.new(Color3.new(5).R, Color3.new(5).G, Color3.new(5).B). You really shouldn’t be doing this.

3 Likes