Tweening a Model's Rotation with a pause

Hello,
I’m trying to tween a model’s rotation 90 degrees, then have it pause, then rotate another 90 degree’s and pause and repeat indefinitely. My problem is that the model rotates but it keeps resetting to the original orientation instead of continuing where it left off. Thanks, for the help!

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(10,Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1,false,0 )

while true  do
	
	local part = game.Workspace.DemonSlayer.MazeSpin.Maze.Pivot 

	local goal = {CFrame =CFrame.new(part.Position) *CFrame.Angles(0,math.rad(90),0)} 
	local goal2 = {CFrame =CFrame.new(part.Position) *CFrame.Angles(0,math.rad(180),0)}
	local goal3 = {CFrame =CFrame.new(part.Position) *CFrame.Angles(0,math.rad(270),0)}
	local goal4 = {CFrame =CFrame.new(part.Position) *CFrame.Angles(0,math.rad(360),0)}
	local tween = TweenService:Create(part, tweenInfo, goal)
	local tween2 = TweenService:Create(part, tweenInfo, goal2) 
	local tween3 = TweenService:Create(part, tweenInfo, goal3) 
	local tween4 = TweenService:Create(part, tweenInfo, goal4) 	
	
	tween:Play() 
	wait(20)	
	tween2:Play() 
	wait(20)	
	tween3:Play() 
	wait(20)	
	tween4:Play() 
	wait(20)	
end

use CFrame

Model:SetPrimaryPartCFrame(Model.BasePart.CFrame * CFrame.Angles(math.rad(90),0,0))

or do it the other way with tweening

TweenService:Create(Model.BasePart,Tweeninfo.new(10),{CFrame = Model.BasePart.CFrame * CFrame.Angles(math.rad(90),0,0)}):Play()
2 Likes

I did use CFrame and I did use the Tweening method. Like I said, the problem is that it keeps resetting to the original orientation instead of continuing where it left off

Your suggestion has the same problem

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(10,Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1,false,10 )
local part = game.Workspace.DemonSlayer.MazeSpin.Maze.Pivot 

	local goal = {CFrame =part.CFrame *CFrame.Angles(0,math.rad(90),0)} 

	local tween = TweenService:Create(part, tweenInfo, goal)

tween:Play()

U can use lerp for this instead of tween

while true do
      wait(20)
      for i = 0,10 do
            Model.PrimaryPart.CFrame = Model.PrimaryPart.CFrame:Lerp(Model.BasePart.CFrame * CFrame.Angles(0,math.rad(90),0), 0.1)
      end
end

Thanks for the suggestion but your LERP solution has the same problem. I saw the solution weeks ago when looking for something totally different but now I can’t find it. I remember them turning 90 degree’s then “saving” the new orientation

I solved it. It’s all about where and when I defined my other tweens. Thanks for trying

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(10,Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0,false,0 )
local part = game.Workspace.DemonSlayer.MazeSpin.Maze.Pivot 



while true  do
	local goal = {CFrame =part.CFrame *CFrame.Angles(0,math.rad(90),0)} 
	local tween = TweenService:Create(part, tweenInfo, goal)
	tween:Play() 
	wait(20)
	local goal2 = {CFrame =CFrame.new(part.Position) *CFrame.Angles(0,math.rad(180),0)}
	local tween2 = TweenService:Create(part, tweenInfo, goal2) 
	tween2:Play() 
	wait(20)	
	local goal3 = {CFrame =CFrame.new(part.Position) *CFrame.Angles(0,math.rad(270),0)}
	local tween3 = TweenService:Create(part, tweenInfo, goal3) 
	tween3:Play() 
	wait(20)	
	local goal4 = {CFrame =CFrame.new(part.Position) *CFrame.Angles(0,math.rad(360),0)}
	local tween4 = TweenService:Create(part, tweenInfo, goal4) 
	tween4:Play() 
	wait(20)	
end