How would I tween Beam colors

So i’ve tried to tween beamcolors, and it simply didn’t work, so now imma go ahead and ask if anyone knows how to tween beamcolors, because i’ve looked for it and i didn’t saw any topic about that.

unknown

2 Likes

The reason it isn’t working is because beam colors are color sequences not color3s. Tween service doesn’t support tweeting color sequences. You will have to write a custom version to handle it.

2 Likes

So, we can’t tween ColorSequences as TweenService doesn’t support it. We have a workaround with this though: You can create a Color3Value and tween that object’s value, and in a while loop or Heatbeat event, you will update the Beam’s colour:

local ts = game:GetService("TweenService")
local val = Instance.new("Color3Value")
val.Value = --initial colour

local active = true
local t = ts:Create(val, TweenInfo.new(1), {Value = nextcolour})
t:Play()

t.Completed:Connect(function()
   active = false
   t:Destroy()
   t = nil
end)

while active do
   Beam.Color = ColorSequence.new(val.Value)
   wait()
end

val:Destroy()

Alternatively, you can use Color3:lerp(), which blends two colours together based on an alpha (a number between 0 and 1):

local colour = Beam.Color.Keypoints[1].Value -- gets the colour of the Beam
local Time = 1

for i = 0, 1, wait() / Time do
    Beam.Color = ColorSequence.new(colour:lerp(newcolour, i))
    wait()
end
13 Likes

I’m having issues with this method.

Not sure why, but I think I did something wrong.

I had a similar issue, try boatbombers tween module:

you can tween beam colour, transparency and all that with this.