How do i make the tween wait for a bit before repeating?

I have made 2 blocks that I want to tween, that goes up and down, but after the tween starts theres like a 0.5 second wait before repeating. what do I need to do? my script:

	local tweenService = game:GetService("TweenService")
	local Base = workspace.HydraulicPressBase
	local Baseback = workspace.HydrualicPressBakc
	local tweeningInformation = TweenInfo.new(
	
	3,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0, -- which part do I need to change so it can wait a bit before repeating?
	false,
	1
	)
	
	local BaseProp = {
	
	Position = Vector3.new(-2.5, 1.5, -0.5)}
	
	local tween = tweenService:Create(Base,tweeningInformation,BaseProp)
	tween:Play()
	
	local BackProp = {
	
	Position = Vector3.new(-2.5, 39.5, -0.5)}
	local tween = tweenService:Create(Baseback,tweeningInformation,BackProp)
	tween:Play()

As far as I know, there isn’t a part of tween info that does this. Since you’re just tweening up and down, create two tweens, one for up, and one for down.

Make sure to wait the amount of time the tween is set to take after each tween, since tweens don’t yield until they are finished.

You can then add the delay amount to each of those waits. I would add together a wait and delay variable stored outside of the loop, so you can easily change the values of each above.

Now, the code will wait the extra delay time before executing the next tween.

Use a loop to repeat this infinitely.

3 Likes