Hello! I’m trying to make a Door Tween, where 2 Doors slide open whenever I type a command I made. I’m using OOP in this script, and I’m new to it (not relevant to the issue). The doors seem to go the opposite way, and then go where they were supposed to go.
Video that shows what happens:
Relevant Code (not the whole script):
function DoorModule:OpenDoor()
if self.isOpen == false then
local LeftDoorTween = TweenService:Create(self.Model.LeftDoor, TweenInfo.new(self.Time, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Position = self.Model.LeftDoor.Position - Vector3.new(0, 0, self.Model.LeftDoor.Size.Y)})
local RightDoorTween = TweenService:Create(self.Model.RightDoor, TweenInfo.new(self.Time, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Position = self.Model.RightDoor.Position + Vector3.new(0, 0, self.Model.RightDoor.Size.Y)})
LeftDoorTween:Play()
RightDoorTween:Play()
self.isOpen = true
else
warn(self.Model.Name .. " is already open!")
end
end
function DoorModule:CloseDoor()
if self.isOpen == true then
local LeftDoorTween = TweenService:Create(self.Model.LeftDoor, TweenInfo.new(self.Time, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Position = self.Model.LeftDoor.Position + Vector3.new(0, 0, self.Model.LeftDoor.Size.Y)})
local RightDoorTween = TweenService:Create(self.Model.RightDoor, TweenInfo.new(self.Time, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Position = self.Model.RightDoor.Position - Vector3.new(0, 0, self.Model.RightDoor.Size.Y)})
LeftDoorTween:Play()
RightDoorTween:Play()
self.isOpen = false
else
warn(self.Model.Name .. " is already closed!")
end
end
If you have any other ideas on how I could improve on this, please tell me!