Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this colorsequence.new always spit out white?

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question