I have a slight issue where I am trying to create a spotlight system for a dance club. I need the spotlights to be able to dim and change intensity. I am using beams to replicate the light beams from the spotlights, but the transparency property on beams is a NumberSequence. NumberSequences are not tweenable, as far as I know.
If you’re simply trying to reduce the overall transparency, you could do this:
local function tweenTransparency(object, fromValue, toValue, tweenInfo)
local numberValue = Instance.new("NumberValue")
numberValue.Value = fromValue
numberValue.Changed:Connect(function(value)
object.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, value),
NumberSequenceKeypoint.new(1, value)
})
end)
local tween = tweenService:Create(numberValue, tweenInfo, { Value = toValue })
tween.Completed:Once(function()
numberValue:Destroy()
end)
tween:Play()
end
tweenTransparency(beamObject, 0, 1, TweenInfo.new(5)) -- Example to tween transparency from 0 to 1 over 5 seconds.