RGB won't work?

So basically the RGB property isn’t working very well on this script I’m doing.

What it looks like:

So as you can see, even though the arm colors are just one number off, they are producing very different results, both of which aren’t the color shown on the color swatch.

When I go into the body colors of the character this is what’s happening:
weirdhuh

The colors aren’t even the ones I’m specifying…

Here’s my code:

Local:

local red
local green
local blue
script.Parent.FocusLost:Connect(function(enterPressed, inputObject)
	if enterPressed then
		local color = string.split(script.Parent.Text, ",")
		for i, v in ipairs(color) do
			if i == 1 then
				red = tonumber(v)
			elseif i == 2 then
				green = tonumber(v)
			elseif i == 3 then
				blue = tonumber(v)
			end
		end
		script.Parent.Parent.ImageLabel.BackgroundColor3 = Color3.fromRGB(red, green, blue)
		game:GetService("ReplicatedStorage").RemoteEvent2:FireServer(red, green, blue, "LeftArmColor3")
	end
end)

Server-side:

game:GetService("ReplicatedStorage").RemoteEvent2.OnServerEvent:Connect(function(p, r, g, b, a)
	p.Character["Body Colors"][a] = Color3.fromRGB(r, g, b)
end)

If anyone knows what’s going on this would be great, thanks.

Are there any error codes? Because your code is working perfectly fine for me.

No, no error codes. That’s the weird part… I know this code should work perfectly, but look how messed up the Body Colors are versus the color swatch that is the exact same value (or should be)

Could you try putting a print command within the code in both server sided and client? See if the color actually matches.

Alright, doing so…

I’m bewildered.

Maybe this is a bug that’s not my fault?

try to do Color3.new(r, g, b)?

It just made it yellow, unfortunately (maxed out 255,255,0)

try to do this and send me the output

game:GetService("ReplicatedStorage").RemoteEvent2.OnServerEvent:Connect(function(p, r, g, b, a)
    print(a)
    print(p.Character["Body Colors"][a])
    print(r,g,b)
	p.Character["Body Colors"][a] = Color3.fromRGB(r, g, b)
end)

hereyougo

hmm, wait a min can u also send me a pic how this output too?

game:GetService("ReplicatedStorage").RemoteEvent2.OnServerEvent:Connect(function(p, r, g, b, a)
    print(a)
    print(p.Character["Body Colors"][a])
    print(r,g,b)
    print(p.Character["Body Colors"][a])
	p.Character["Body Colors"][a] = Color3.fromRGB(r, g, b)
end)

I switched the last two lines around because then you would just be printing the same thing twice:

hereyago2

hmm here you can see that the color that u set for LeftArmColor3 is not equal to the RGB color u want

If you convert that number to fromRGB format, it is though. This has got to be a bug.

I think so too, hmmm try to do different stuff and see if there is any solution. If not then just report it :slight_smile: sorry about it

1 Like

GROUNDBREAKING DISCOVERY:

I’ve been changing it from the server right?
Well it does change on the server, but not on the client

@Ashp116

what the heck??? are you also changing the color on the client side too?

No, but I’ll try it even though that’s super inefficient

OK, if the color that is showing the client different from the server its the client that might be overwriting the color

Ha! I saw it be the true color for one tiny second! This is still very weird.

If I enter the number twice after adding a repeat-until locally, it works.