— set values to starting color
Local r = 255
Local g = 0
Local b =0
Repeat
Beam.color = r, g, b
R -= 1 —change values as desired
G += 1
B = 0
Until beam.color == 0, 255, 0 —set as ending color
Honestly, “Tweening” color sequences or number sequences can be a pain, since you’ll need your own tweening process for that, luckily Roblox does provide TweenService:GetValue(alpha, easing_style, easing_direction) to help with that process.
Personally I compile the sequences into a easily readable and manipulatable table, which can also be used to set a sequence. Then run each value through a lerp process, either manual or using roblox’s GetValue from tween service. The only caveat to tweening sequences is you have to have the same amount of timesteps for it to look good without snapping.
I see a lot of people mimicing tween’s using basevalues like Instance.new("NumberValue") then tween the number value from 0 → 1 while having the base value hooked up to a .Changed:Connect() event. It works quite well tbf.
-- // turns color sequence into an editable keypoints
function module:GetKeypoints(colorSequence)
local keypoints = {}
for _, keypoint : ColorSequenceKeypoint in pairs(colorSequence.Keypoints) do
table.insert(keypoints, {Time = keypoint.Time, Value = keypoint.Value})
end
return keypoints
end