Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My fading light stops after first fade? [SOLVED]

Asked by 3 years ago
Edited by JesseSong 3 years ago

This question has been solved by the original poster.

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

Log in to vote
0
Answered by 3 years ago

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

0
There is, it is the name of the first tween. But I've figured it out now anyways, no worries. maddiesswrld 30 — 3y
0
There is no such thing as :End() virushunter9 943 — 3y
0
:End() is not a method/function in Roblox. JesseSong 3916 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

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)

Answer this question