Tween.Completed:Wait() freezes the entire script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
  • So, I want to recreate Doors (Don’t judge me, Doors but Bad exists too), and I’m currently working on the lobby. The base game Is not yet done, but I just want to get it done.
    I was working on the lift doors Opening/Closing Tweens, when I stumbled Upon this issue.
  1. What is the issue? Include screenshots / videos if possible!

Basically, the Tween.Completed:Wait() function takes Forever. It literally freezes, and No progress after that. This wasn’t the first time aswell, I stumbled upon this in the main game, but I managed to do it using wait().

(Couldn’t provide video because software didn’t work)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
  • No, I did not

Script:

local TeleportService = game:GetService("TeleportService")
local TweenS = game:GetService("TweenService")
local info = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local PLAYERS_PER_LIFT = 1

local Info = script.Parent.ServerInfo

local Lobby = {}

local OpenPos = script.Parent.Parent.Door.Position - Vector3.new(6.9, 0, 0)
local ClosedPos = script.Parent.Parent.Door.Position

local OpenTween = TweenS:Create(script.Parent.Parent.Door, info, {Position = OpenPos})
local CloseTween = TweenS:Create(script.Parent.Parent.Door, info, {Position = ClosedPos})

-- Default
local function SetDefault()
	Info.PlrCount.Text = "0/"..(tostring(PLAYERS_PER_LIFT))

	Info.Misc.Text = "Waiting for players..."
	Info.CountDown.Text = ""
	
	OpenTween:Play()
end

SetDefault()

local Debounce = true

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local character = hit.Parent
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		if not table.find(Lobby, plr) then
			table.insert(Lobby, plr)
			print(#Lobby)
			print(table.getn(Lobby))
			Info.Misc.Text = "Teleporting in..."
			
			character.PrimaryPart.CFrame = script.Parent.Parent.TpPoint.CFrame
			
			Info.PlrCount.Text = #Lobby.."/"..PLAYERS_PER_LIFT
			
			local Time = 5
			wait(0.5)
			while Time > 0 do
				Time -= 1
				Info.CountDown.Text = tostring(Time)
				wait(1)

				if table.getn(Lobby) <= 0 then
					SetDefault()
					break
				end
			end
			
			Info.Misc.Text = "Teleporting..."
			Info.CountDown.Text = ""
			CloseTween:Play()
			CloseTween.Completed:Wait() -- PROBLEM
			OpenPos:Play()
		end
	end
end)

I don’t know if this is a bug or something. It doesn’t work for me at least. Any help appreciated!

Can you try putting a print line (or a breakpoint) after .Completed line and see if it actually runs the tween?

Ok, nevermind. I was stupid as heck.

That’s a Vector3 value.

I messed up.

Bruh