Color3.fromRGB turns into Color3.new

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want you to teach me how to turn Color3.new to Color3.fromRGB

  2. What is the issue? Color.fromRGB turns into Color.new

  3. What solutions have you tried so far? Yes

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local MaximumDifficultyColors = {
	[1] = Color3.fromRGB(0, 255, 0),
	[2] = Color3.fromRGB(50, 125, 0),
	[3] = Color3.fromRGB(175, 255, 0),
	[4] = Color3.fromRGB(255, 255, 0),
	[5] = Color3.fromRGB(255, 200, 0),
	[6] = Color3.fromRGB(255, 150, 0),
	[7.5] = Color3.fromRGB(255, 0, 0),
	[math.huge] = Color3.fromRGB(100, 100, 100),
}

image_2024-09-10_175837166

Screenshot 2024-09-10 174659

Thanks for reading
Have a good day :smiley:

1 Like

Color3.fromRGB takes the red, green and blue components as values between 0 and 255,
while Color3.new takes the red, green and blue components as values between 0 and 1.

To turn .new() components into .fromRGB() components, multiply them by 255. Likewise, to go from .fromRGB() values to .new() values, simply divide by 255.

Yes, But I wanna use Color3.fromRGB not Color3.new

1 Like

I don’t understand. Can you please provide examples of what you mean?

1 Like

Oh wait the video doesnt have output, 1 sec

I want you to see what am I wrong, I didnt see the wrong thing, But it still returns Color3.new

1 Like

Ok, in the new image you attached, it is showing the Color3 object values.

.new and .fromRGB both create the Color3 object, so they are just 2 means of getting to the goal. You don’t need to change anything in your code - all the colors in the output are the same as they are in the fromRGB table you provided.

But when I take a look at color I assign with, It didnt change, I didnt see any problems
image_2024-09-10_180210753

1 Like

What code are you using to change the color of the part?

1 Like

From rgb just takes inputs from 255 but internally scales them down into numbers from 0 - 1. 255 is the same as 255/255 which is 1 leading it to be the same as regular Color3 values.

Wait, Somehow I restart my roblox studio and it works

I think the solutions is for u I think so…

1 Like

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