I’d like it to be tweened the OTHER direction. It’s going to the right place, just not the right direction.
The script I’m using is:
local TweenService = game:GetService('TweenService')
local Door = game.Workspace.DoorModelC.Door.BASE
local Opened = workspace.DoorModelC.Open
local Closed = workspace.DoorModelC.Closed
local Open = false
local Close = true
local OpenInfo = TweenInfo.new(
8,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)
local OpenGoals =
{
CFrame = Opened.CFrame
}
local OpenAnimation = TweenService:Create(Door, OpenInfo, OpenGoals)
local ClosedInfo = TweenInfo.new(
8,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)
local ClosedGoals =
{
CFrame = Closed.CFrame
}
local CloseAnimation = TweenService:Create(Door, ClosedInfo, ClosedGoals)
OpenAnimation:Play()
script.Disabled = true
You should slightly rotate it to the direction you want it to go in before running this. It seems like you’re rotating it 180 degrees so it defaults to the wrong way.
local TweenService = game:GetService('TweenService')
local Door = game.Workspace.DoorModelC.Door.BASE
local Opened = workspace.DoorModelC.Open
local Closed = workspace.DoorModelC.Closed
local Open = false
local Close = true
local OpenInfo = TweenInfo.new(
8,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)
local OpenGoals =
{
CFrame = Opened.CFrame
}
local OpenAnimation = TweenService:Create(Door, OpenInfo, OpenGoals)
local ClosedInfo = TweenInfo.new(
8,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)
local ClosedGoals =
{
CFrame = Closed.CFrame
}
local CloseAnimation = TweenService:Create(Door, ClosedInfo, ClosedGoals)
OpenAnimation:Play()
script.Disabled = false
TweenService will always automatically choose the shortest route to rotate a part where it needs to. There’s unfortunately no way to customize which direction it turns in ( though it’d be nice).
In this case, you’ll have to either do multiple tweens in a row (which would be difficult to keep smooth as I see you’re using the Sine EasingStyle, so if you wanted to compromise and make the EasingStyle Linear instead the smoothness would be retained) or you can use a for loop. If you want maximum smoothness, I recommend RenderStepped like my example below for rotating. If you wanted to switch the direction, just make the y-value in CFrame.Angles negative
Tween service is still the best option here. alex only needs to update the doors CFrame once before tweening to ensure that the shortest path is the correct one. Put this before OpenAnimation:Play()
no difference, thank you for the help though. I am disabling the script as it disables once the tween has begun and means we can reuse this script etc…
I updated my comment with the answer. If -1 degrees doesn’t work, just fiddle with it. Alternatively, just slightly rotate your open or closed part in the direction you want the door to rotate. It doesn’t have to be noticable.