Tweens playing at the same time

I’m trying to make a model tween their position first, and rotation second, but for some reason after the first tween, it just does both at the same time.
thatonevideowherefishbreaks

local TweenService = game:GetService("TweenService")
local debounce = false
local Rotate1 = script.Parent
local RotateRoot1 = Rotate1.PrimaryPart

local RotateSwingInfo1 = TweenInfo.new(2,Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false,0)

local PanelSwingTween = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.new(0,0,-25)
})
local PanelSwingTween2 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.Angles(0,math.rad(-180),0)
})
local PanelSwingTween4 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.new(0,0,0)
})
local PanelSwingTween3 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.Angles(0,math.rad(0),0)
})
PanelSwingTween.Completed:Connect(function()
	task.wait(1)
	PanelSwingTween2:Play()
end)
PanelSwingTween2.Completed:Connect(function()
	task.wait(1)
	PanelSwingTween3:Play()
end)
PanelSwingTween3.Completed:Connect(function()
	task.wait(1)
	PanelSwingTween4:Play()
end)
PanelSwingTween4.Completed:Connect(function()
	task.wait(1)
	PanelSwingTween:Play()
end)
PanelSwingTween:Play()

I don’t really know whats wrong with my script.

1 Like

Hey! A friend and I tested this in studio earlier. I’ll try to be brief. Essentially, you’re not factoring in the updated position of the fish

When declaring all these variables, they are all based off the original position of your fish.

local PanelSwingTween = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.new(0,0,-25)
})
local PanelSwingTween2 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.Angles(0,math.rad(-180),0)
})
local PanelSwingTween4 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.new(0,0,0)
})
local PanelSwingTween3 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.Angles(0,math.rad(0),0)
})

Instead, try declaring the tweens after the preceding tween is completed, so it takes into account the updated position of the fish.

For example:

PanelSwingTween.Completed:Connect(function()
	task.wait(1)
     local PanelSwingTween2 = TweenService:Create(RotateRoot1, RotateSwingInfo1, {
	CFrame = RotateRoot1.CFrame * CFrame.Angles(0,math.rad(-180),0)
})

	PanelSwingTween2:Play()
end)

In this tween, it gets the most recent value of the CFrame, instead of the old one.

Hope it helps!

2 Likes

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