Tween.Ended isn't working!

Alright. I wanted to make a tween, and when it ends, wait 4 seconds, do something else. Here’s my code:

local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
	local goal = {Position = UDim2.new(0.5, 0, 0.25, 0)}
	local tween = tweenService:Create(popup, tweenInfo, goal)
	tween:Play()
	tween.Ended:Wait(4)

However, when I run it, I get an error

Ended is not a valid member of Tween “Tween”

Anyone know a fix?

tween:Play()
tween.Completed:Wait()
task.wait(4)
1 Like

Explanation:

The tween.Ended:Wait() function waits for the event to fire and pause the script until the event gets triggered and after it fires, it returns the arguments.

Now, this CANNOT be treated as a wait(number) function and has to be done on a seperate line in order to function as a wait(4). like for instance:

tween:Play()
tween.Completed:Wait()
task.wait(4)
print("tweening completed")

This was already solved by @2112Jay.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.