Hi, I’m having a problem with some floors right now in my game. I want to make another part the same color as it, but the color of that part is way different than what the floor looks like, it’s obviously because of the material, but how do I get the color it appears as instead of the color it has?
My approach is very oversimplified, and would only work for plastic and smooth plastic, but I’d suggest taking a screenshot and using a color picker from a paint app to see the color.
Basically, you’re saying do it manually?
That’d be the only solution I could think of to the problem, yes.
Wait, but what if the color is changing constantly? What would I do then?
Well I do not believe there is a way to see built into Roblox, so this is the best you could do, sorry. If you’re doing it for quality of life for the player, so they see the colors accurately in a customization menu you could use ViewportFrames and show a part with the material and the color instead.
I’m not quite sure how Roblox applies materials and brick colors together. But assuming it’s additive, I would suggest trying to find an RGB value for the second material that makes the bricks match, and then make the script that updates the color of the first brick set the other brick to that color +/- the difference. The relationship will differ based on the materials the two bricks use, so you’ll need probably need to figure it out for each material pair. If it’s multiplicative, I don’t know how to do it though.
I’m not too familiar with how colors and that jiff works, could you write this out in a script, that the only language I understand.
If the problem is that the first object has a different material than the first, and the material is somehow affecting the color, then you might need to edit the material so that it doesn’t affect the color in the same way.
as the other replies were saying…
- color pick the color to find its exact match.
- find the difference in color value
- Make a script that changes the color of the second object to be the same as the first + or - the difference.
Doing this should make the colors the same each time.
(if this doesn’t make sense here’s an example with numbers.
object.1 = 1 object.2= 2
object.1= object.2 -1
To make object.1 = object.2 you would need to -1 from object.2’s value.)
Okay, but I don’t understand what that last illustration was saying, could you explain?
If you understand the rest then I think that’s more important, but I’ll try to explain it like this.
Let’s say object1 is orange and object2 is red. For object2 to be the same color as object1, you will need to add yellow to object2.
if object1 changes to green and object2 changes to blue, the difference will remain the same. For object2 to be the same color as object1, you will need to add yellow to object2.
And how would I get yellow from red and orange?
you wouldn’t. at least not in this example, if that’s what you are asking
you are adding the yellow to whatever color object2 is so that it can be the same as object1
object2 + yellow = object1
I’m sorry, but I’m just not understanding how I can implement this into a script, if there’s no way to get yellow from the color. I want to make part1’s color the same as part2’s color, but part2 has a material that offsets it a bit.
That was an just example of the concept (I don’t know the actual difference between your objects as I have not seen them)
Every color can be expressed as a combination of 3 values, r (red) g (green), and b (blue), all ranging from 0 - 255. For example, the color white is r-255 g-255 b-255. The color black is r-0 g-0 b-0. The color red is r-255 g-0 b-0. The color blue is r-0 g-0 b-255. The color Magenta is r-255 g-0 b-255
Since I am not a coder, I asked the Roblox AI assistant to create a code that adds 7 more of the green value to a part
-- Changes the color of a part to match another part's color with additional green
-- Define the parts
local part1 = workspace.Part1 Replace -- "Part1" with the name of the first part
local part2 = workspace.Part2 -- Replace "Part2" with the name of the second part
-- Get the color of part2
local color2 = part2.BrickColor.Color
-- Extract the RGB values from color2
local r, g, b = color2.r, color2.g, color2.b
-- Add 7 to the green value
g = g + 7
-- Create a new Color3 with the modified RGB values
local newColor = Color3.new(r, g, b)
-- Change the color of part1 to the new color
part1.BrickColor = BrickColor.new(newColor)
This will only work if the difference in your two parts’ R G B values is 7 green.
The difference in your parts is different. Refer back to my first reply for how to find the difference between your specific parts.
Once you find the difference, you can add or remove it to make the color appear the same.