Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My fading light stops after first fade? [SOLVED]

I'm making a light that fades out, then back in a blinking pattern using TweenService. It fades out, but it won't fade back in. How do I fix this?

TweenService = game:GetService("TweenService")
info = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)

local changeVal = .8;
local changeVal2 = 12;

Light = TweenService:Create(script.Parent.SpotLight, info, {Brightness = changeVal})

Light:Play()

Light.Completed:End()

Light2 = TweenService:Create(script.Parent.SpotLight, info, {Brightness = changeVal2})

Light2:Play()

Light2.Completed:End()

2 answers

There is no such thing as Light.Completed:End(). Replace it with Light.Completed:Wait()

3 comments

0

There is, it is the name of the first tween. But I've figured it out now anyways, no worries.

0

There is no such thing as :End()

0

:End() is not a method/function in Roblox.

I've figured it out, just a quick adjustment.

TweenService = game:GetService("TweenService")
info = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)

local changeVal = .8;
local changeVal2 = 12;

Light = TweenService:Create(script.Parent.SpotLight, info, {Brightness = changeVal})
Light2 = TweenService:Create(script.Parent.SpotLight, info, {Brightness = changeVal2})

Light:Play()

Light.Completed:Connect(function()Light2:Play() end)

This discussion is preserved as it was. New answers, comments, and votes are closed.