Help using tweenservice for elevator doors

i dont have much experience with tweenservice ive probably used it like 3 times in my entire life, do i really need to create multiple tweens for each part and each direction??

--TweenService
local TweenService = game:GetService("TweenService")

local OpenInfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
local CloseInfo = TweenInfo.new(1.2,Enum.EasingStyle.Linear)

local OpenLeft = TweenService:Create(Doors.DoorLeft,OpenInfo,{CFrame = Doors.DoorLeft.CFrame * CFrame.new(0,0,-3)})
local OpenRight = TweenService:Create(Doors.DoorRight,OpenInfo,{CFrame = Doors.DoorRight.CFrame * CFrame.new(0,0,3)})

local CloseLeft = TweenService:Create(Doors.DoorLeft,CloseInfo,{CFrame = Doors.DoorLeft.CFrame})
local CloseRight = TweenService:Create(Doors.DoorRight,CloseInfo,{CFrame = Doors.DoorRight.CFrame})

function ElevatorFunctions.OpenDoors()
	OpenLeft:Play()
	OpenRight:Play()
end

function ElevatorFunctions.CloseDoors()
	CloseLeft:Play()
	CloseRight:Play()
end
1 Like

Yeah, you’ve used it correctly

TweenInfo has a variable named Reverse, if you change that to True, then once the elevator doors open, they’ll close again.
You can also use DelayTime to make the tween run a little later.

Unfortunately, the elevator doors will have to be closdd when you call the tween, otherwise when it reverses the doors wont close, but instead will go to the position they were when the new tween was called.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.