Hi. I am trying to tween parts using the TweenService in Roblox but the parts keep rotating to its original native angle instead of the rotation it was at before the tweening. Is there any way to fix this?

local left = script.Parent.Door1
local model = script.Parent
local trigger = script.Parent.DoorT
local l2 = script.Parent.Door2

local tweenService = game:GetService("TweenService")

local tweeningInfo = TweenInfo.new(
    0.5,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)

local lClose = {CFrame = CFrame.new()} -- removed position values, values are actually here in script.
local lOpen = {CFrame = CFrame.new()}-- removed position values, values are actually here in script.
local l2Open = {CFrame = CFrame.new()}-- removed position values, values are actually here in script.
local l2Close = {CFrame = CFrame.new()}-- removed position values, values are actually here in script.

local r2Close = {CFrame = CFrame.new()}-- removed position values, values are actually here in script.
local rClose = {CFrame = CFrame.new()}-- removed position values, values are actually here in script.
local r2Open = {CFrame = CFrame.new()}-- removed position values, values are actually here in script.
local rOpen = {CFrame = CFrame.new()}-- removed position values, values are actually here in script.

local LO = tweenService:Create(left,tweeningInfo,lOpen)
local LC = tweenService:Create(left,tweeningInfo,lClose)
local L2O = tweenService:Create(l2,tweeningInfo,l2Open)
local L2C = tweenService:Create(l2,tweeningInfo,l2Close)
local R2C = tweenService:Create(r2,tweeningInfo,r2Close)
local RC = tweenService:Create(r,tweeningInfo,rClose)
local R2O = tweenService:Create(r2,tweeningInfo,r2Open)
local RO = tweenService:Create(r,tweeningInfo,rOpen)

trigger.Touched:Connect(function(h)
    LO:Play()
    L2O:Play()
    R2O:Play()
    RO:Play()
    wait(2)
    LC:Play()
    L2C:Play()
    RC:Play()
    R2C:Play()
end)

2 comments

0

Refrain from posting the code offsite; the code was perfectly able to fit into the question. Plus why do you hide the position values as if they are passwords? They are not.

0

I am fully aware they are not. This is the original script. I put in the values after i put the script in game.