Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this colorsequence.new always spit out white?

Alright, i'm sure I did something wrong (ofc I did), but heres what im trying to do. Whenever you touch this certain brick, it will fade out, and then it will change color and fade back in. Well, I have ParticleEmitters that I guess "move" particles away from the ball when its fading out and towards the ball whenever it fades in. That's all working, but I'm trying to get the color as the same as the ball. I converted (I think) from BrickColor to Color3 to RGB. Anyways, heres the piece of the code that determines the color. Any help would be appreciated. PLEASE DONT SPOON FEED ME, TELL ME WHAT I DID WRONG.

		local a = script.Parent.BrickColor.Color
		local r = a.r*255
		local g = a.g*255
		local b = a.b*255
		print(r,g,b)
		local start = Color3.new(r,g,b)
		local endd = Color3.new(r,g,b)
		for i,v in pairs(script.Parent:GetChildren()) do
				v.Color = ColorSequence.new(start,endd)

1 answer

✓ Accepted answer

Color3 is in the range of 0~1 you *255 in your code which exceeds the max so 1 is used making it white all the time.

You can use Color3.fromRGB but in your case since you are just using the bricks color3 you can use that.

Example

-- uses the same color for the start and end
local colorSeq = ColorSequence.new(script.Parent.BrickColor.Color)
for i,v in pairs(script.Parent:GetChildren()) do
	v.Color = colorSeq 
end

Hope this helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.