Tweening the Brickcolor of an Object Outputs the Wrong Color

I am currently stumped at the moment. I have looked around for answers and I can’t quite figure out why this is happening. I am trying to tween the BrickColor of a characters head to the BrickColor “Sea Green” which equates to a Color3 value of (52, 142, 64) when a certain keyframe of an animation is reached.

When I attempted to tween to this color for some reason it tweens to the BrickColor “Sunrise” which equates to a Color3 value of (204, 114, 192). Now I’m not sure if tweening a BrickColor has to be handled differently than say tweening the position of something so I need some help. This may be a dumb mistake but I haven’t stumbled across the answer quite yet.

Here is the code I have so far:

local anim

if not anim then
    anim = humanoid:LoadAnimation(script.Parent:WaitForChild("Zombify"))
end

local tweenInfo = TweenInfo.new(
    2,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.In,
    0,
    false
)

anim.KeyframeReached:Connect(function(keyframeName)
    if keyframeName == "Zombify" then
        local tween = tweenService:Create(char.Head, tweenInfo, { Color = Color3.new(52, 142, 64) })
        tween:Play()
    end
end)
4 Likes

That’s because you’re using Color3.new and not Color3.fromRGB, In Color3:fromRGB it automatically defaults your numbers to /255, where as it doesn’t do that in Color3.new . Hope this helps you understand, you can read more on it here

If you want to use Color3.new you can just change your values of (52, 142, 64) to (52/255, 142/255, 64/255)

8 Likes

change the Color3.new(52, 142, 64) to Color3.fromRGB(52, 142, 64)

4 Likes

I appreciate your reply! Thank you!

1 Like

Thanks for the help. That makes sense now.

No Problem man, hope that solves any issues you may have with this in the future. Have a good one.

2 Likes