Hello, i’m trying to make tween service move hangar doors, it works fine but problems happen when you rotate entire model.
How it should look like (Example 1)
How it looks when tested with rotated model (Example 2)
Script
local tween = game:GetService("TweenService")
local open = false
local deb = false
script.Parent.ClickDetector.MouseClick:Connect(function()
if deb == false then
deb = true
local part1 = script.Parent.Parent.Dvere1
local part2 = script.Parent.Parent.Dvere2
local info = TweenInfo.new(
5,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut
)
if open == false then
local cil1 = {}
cil1.Position = script.Parent.Parent.Dvere1.Position + Vector3.new(0, 0, -18)
local cil2 = {}
cil2.Position = script.Parent.Parent.Dvere2.Position + Vector3.new(0, 0, 18)
local cil3 = {}
local tween1 = tween:Create(part1, info, cil1)
local tween2 = tween:Create(part2, info, cil2)
tween1:Play()
tween2:Play()
open = true
wait(5)
deb=false
return
end
if open == true then
local cil1 = {}
cil1.Position = script.Parent.Parent.Dvere1.Position + Vector3.new(0, 0, 18)
local cil2 = {}
cil2.Position = script.Parent.Parent.Dvere2.Position + Vector3.new(0, 0, -18)
local cil3 = {}
local tween1 = tween:Create(part1, info, cil1)
local tween2 = tween:Create(part2, info, cil2)
tween1:Play()
tween2:Play()
open = false
wait(5)
deb=false
return
end
end
end)
My question is how to make tween service move Example 2 same way like example 1 even when it’s rotated.