I cant manage to figure out how to add a pause in between the tweens. The script below is a moving model script using PrimaryParts CFrame. How would I be able to add a pause and keep performing this pause in a loop.
wait(2)
local TweenService = game:GetService("TweenService")
local model = workspace.Model
local root = model.PrimaryPart
local defaultTweenInfo = TweenInfo.new(3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,-1,true,0)
TweenService:Create(root, defaultTweenInfo, {CFrame = workspace.Part1.CFrame}):Play()
TweenService:Create(root, defaultTweenInfo, {CFrame = workspace.Part2.CFrame}):Play()
Make a âcooldownâ, I believe that part of your script is inside a while of for loop. If thatâs the case, do this.
while cooldown = false do
cooldown= true
wait(2)
--Type here the rest of your code
cooldown = false
end
So what this does is whenever it goes inside the loop, it will have a cooldown in which it can not be able to enter the script again until the cooldown is off.
Unsure if this is what youâre looking for by âpause in between the tweensâ but:
wait(2)
local TweenService = game:GetService("TweenService")
local model = workspace.Model
local root = model.PrimaryPart
local defaultTweenInfo = TweenInfo.new(3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,-1,true,0)
local Tween1 = TweenService:Create(root, defaultTweenInfo, {CFrame = workspace.Part1.CFrame}):Play()
Tween1.Completed:Wait() -- wait for tween to finish
wait() -- whatever pause here
local Tween2 = TweenService:Create(root, defaultTweenInfo, {CFrame = workspace.Part2.CFrame}):Play()
Tween2.Completed:Wait()
wait(2)
local TweenService = game:GetService("TweenService")
local model = workspace.Model
local root = model.PrimaryPart
local defaultTweenInfo = TweenInfo.new(3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,-1,true,0)
local Tween1 = TweenService:Create(root, defaultTweenInfo, {CFrame = workspace.Part1.CFrame})
Tween1:Play()
Tween1.Completed:Wait() -- wait for tween to finish
wait() -- whatever pause here
local Tween2 = TweenService:Create(root, defaultTweenInfo, {CFrame = workspace.Part2.CFrame})
Tween2:Play()
Tween2.Completed:Wait()