so i have this tween script for a sliding door. it works fine when the door is on the X-axis, but when the door is on the Y axis, while it is tweening, the parts move to the X axis! any ideas why?
local TweenService = game:GetService("TweenService")
check = false
local sensor = script.Parent
local door1 = script.Parent.Parent.OutsideDoor.DoorLeft
local door2 = script.Parent.Parent.OutsideDoor.DoorRight
local tweeninformation = TweenInfo.new(
0.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
1)
local door1open = {CFrame = CFrame.new(130.024, 6.325, -682.823)}
local door1close = {CFrame = CFrame.new(130.024, 6.325, -688.823)}
local door2open = {CFrame = CFrame.new(130.024, 6.325, -701.048)}
local door2close = {CFrame = CFrame.new(130.024, 6.325, -695.398)}
local tween1open = TweenService:Create(door1,tweeninformation,door1open)
local tween1close = TweenService:Create(door1,tweeninformation,door1close)
local tween2open = TweenService:Create(door2,tweeninformation,door2open)
local tween2close = TweenService:Create(door2,tweeninformation,door2close)
sensor.Touched:Connect(function()
if check == false then
check = true
tween1open:Play()
tween2open:Play()
wait(2)
check = false
tween1close:Play()
tween2close:Play()
end
end)

2 comments
'it works fine when the door is on the x-axis,' what do you even mean by that? In case, you didn't know, the formation of a CFrame and Vector3 value is X, Y, Z
what i mean is the part when the tween is over, the longest side will like rotate so that it is facing the x- axis, i don't really know how to explain, sorry if I'm not explaining the best