I want to make a door that opens after 5 seconds. I used wait() but instead of waiting, it tweens the door instantly.
Script:
local TweenService = game:GetService("TweenService") local tweenPart = script.Parent.Door1 local tweenPart2 = script.Parent.Door2 local info = TweenInfo.new( script.Parent.Open.TimeLength, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0 ) local goals = { Position = script.Parent.Door1Open.Position } local goals2 = { Position = script.Parent.Door2Open.Position } local tween = TweenService:Create(tweenPart, info, goals) local tween2 = TweenService:Create(tweenPart2, info, goals2) wait(5) tween:Play() tween2:Play()
Any help please?
The tween you played does not wait for you, so you have to wait for it.
In a nutshell, playing a tween doesn't make it continue the rest of the code after the entire tween have played
tween:Play() wait(script.Parent.Open.TimeLength) -- This is the same amount of time as the TweenInfo tween2:Play()