Tween is not playing (It's just jumping from one place to another)

local lpassdoor = script.Parent.Parent.PassengerDoors.DoorLockL
local rpassdoor = script.Parent.Parent.PassengerDoors.DoorLock
local passdoor = script.Parent.Parent.PassengerDoors
local TweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
	3,
	Enum.EasingStyle.Quart,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)
script.Parent.OnServerEvent:Connect(function(plr, state, side)
	if side == "Left" then
		if state == false then
			lpassdoor.Value = false
			for i, v in pairs(script.Parent.Parent.Metro4000.Train.DriveSystem:GetDescendants()) do
				if v.ClassName == "Part" then
					v.Anchored = true
				end
			end
			for _, model in pairs(passdoor:GetDescendants()) do
				if model.Name == "LeftSide" then
					model.Door.Union.Anchored = true
					model.Door2.Union.Anchored = true
					for i, object in pairs(model:GetDescendants()) do
						if object.Name == "Colour" then
							object.Color = Color3.fromRGB(0, 255, 0)
						end
					end
				end
			end
		elseif state == true then
			lpassdoor.Value = true
			passdoor.Part.Beep:Play()
			passdoor.Part.Beep.Ended:Wait()
			passdoor.Part.AirReleas:Play()
			for i, v in pairs(passdoor:GetChildren()) do
				if v.Name == "LeftSide" then
					for i, col in pairs(v:GetChildren()) do
						if col.Name == "Colour" then
							col.Color = Color3.fromRGB(255, 0, 0)
						end
					if v.Toggle.Value == true then
						local ClosePos1 = {CFrame = v.Door.Union.CFrame * CFrame.new(0,-2.6,0)}
						local ClosePos2 = {CFrame = v.Door2.Union.CFrame * CFrame.new(0,2.6,0)}
						local Close1 = TweenService:Create(v.Door.Union, tweeninfo, ClosePos1)
						local Close2 = TweenService:Create(v.Door2.Union, tweeninfo, ClosePos2)
						Close1:Play()
						Close2:Play()
						v.Toggle.Value = false
						lpassdoor.Value = true
						end
					v.Door.Union.Anchored = false
					v.Door2.Union.Anchored = false
					end
				end
		end end

Hi everyone, my issue is that my tween is/isn’t playing. It takes the door the amount of time needed to do the tween but it doesn’t actually slide, it just magically pops to where it’s supposed to be. The part of the script I have the issue with is:

						local ClosePos1 = {CFrame = v.Door.Union.CFrame * CFrame.new(0,-2.6,0)}
						local ClosePos2 = {CFrame = v.Door2.Union.CFrame * CFrame.new(0,2.6,0)}
						local Close1 = TweenService:Create(v.Door.Union, tweeninfo, ClosePos1)
						local Close2 = TweenService:Create(v.Door2.Union, tweeninfo, ClosePos2)
						Close1:Play()
						Close2:Play()
						v.Toggle.Value = false
						lpassdoor.Value = true
						end

I’m unsure as to why this is happening, if you need anything else to help like pictures of the train layout etc, just say.

Why do you have your CFrame values stored in a table?

In your case you should index the CFrame within the table.

local Close1 = TweenService:Create(v.Door.Union, tweeninfo, ClosePos1.CFrame)

Like such ^, Also, i wouldn’t recommend storing CFrame values within their own individual tables.

local ClosePos1 = {CFrame = v.Door.Union.CFrame * CFrame.new(0,-2.6,0)}
--ClosePos1 Could become
local ClosePos1 = v.Door.Union.CFrame * CFrame.new(0,-2.6,0)

That way you wouldn’t need to index the CFrame at the end of this line:

local Close1 = TweenService:Create(v.Door.Union, tweeninfo, ClosePos1.CFrame)

If this doesn’t help, are there any errors in the console?

It now says ‘Unable to cast to dictionary’ for line 47 which is local Close1 = TweenService:Create(v.Door.Union, tweeninfo, ClosePos1)

Did you get rid of the Table? (30 characters)

Yes, I removed the table (30 CHARS)

The TweenService:Create() function requires 3 arguments, the object to tween, TweenInfo, and a dictionary containing the properties to tween. The dictionary there was correct the first time, you can’t just make it a property.

Anyways, can you show us a video of what the tween looks like as it plays?

Hi, here’s a video of what happens, as I described before, there is no real animation to it. It’s just kinda like setting it’s CFrame and that’s it. I have another script for opening the doors and that works just fine. The scripts are almost identical (However, I’ll send a copy for comparison anyways)

https://gyazo.com/66a0fddec1248b4c2cc883ca4e780062 (Doors closing)
https://gyazo.com/fb97d51abc4f16d3723381d08e2db1a5 (Doors opening)

-- (Copy of the door opening script)
local door1 = script.Parent.Parent.Door.Union
local door2 = script.Parent.Parent.Door2.Union
local TweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
	3,
	Enum.EasingStyle.Quart,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

local toggle = script.Parent.Parent.Toggle
local sound = script.Parent.Parent.Sound
local open = script.Parent.Parent.AirReleas
local shut = script.Parent.Parent.AirReleas
local opentone = script.Parent.Parent.OpenDoorSounds
local debounce = false
local InterLock = script.Parent.Parent.Parent.DoorLockL

script.Parent.ClickDetector.MouseClick:Connect(function()
	if toggle.Value == false  and debounce == false and InterLock.Value == false then
		local ClosedPos1 = door1.CFrame
		local ClosedPos2 = door2.CFrame
		local OpenPos1 = {CFrame = ClosedPos1 * CFrame.new(0,2.6,0)}
		local ClosePos1 = {CFrame = OpenPos1.CFrame * CFrame.new(0,-2.6,0)}
		local OpenPos2 = {CFrame = ClosedPos2 * CFrame.new(0,-2.6,0)}
		local ClosePos2 = {CFrame = OpenPos2.CFrame * CFrame.new(0,2.6,0)}
		local Open1 = TweenService:Create(door1, tweeninfo, OpenPos1)
		local Close1 = TweenService:Create(door1, tweeninfo, ClosePos1)
		local Open2 = TweenService:Create(door2, tweeninfo, OpenPos2)
		local Close2 = TweenService:Create(door2, tweeninfo, ClosePos2)
		debounce = true
		open:Play()
		opentone:Play()
		Open1:Play()
		Open2:Play()
		Open2.Completed:Wait()
		opentone:Stop()
		debounce = false
		toggle.Value = true
	end
end)

it may have to do with the fact that in the closing Script, unlike your opening one, you set v.Toggle to be false too quick. You yielded the script based on if the animations were completed in the opening script, try doing it in the closing with

Close2.Completed:Wait()