Easiest teleport bug

I made a counter that repeatedly counts from 30 to 0. But eventually, this error happens:

TeleportService:TeleportPartyAsync error: The player[1579900864] with wrong session.
Then eventually the counter stays at zero and the queue no longer works to teleport you to a different place. Here’s the entire script if you need it:

local num = game.ReplicatedStorage.Values.Chapter1Plrs.Value
local plrs = {}

while true do
		for i = 30, 0, -1 do
		workspace.Queue.Counters.Chapter1.Chapter1Counter.SurfaceGui.TextLabel.Text = i
		wait(1)
	if i == 0 then
	for i, v in pairs(game:GetService("Players"):GetPlayers())do
		if v:WaitForChild("CurrentDoor").Value == "ChapterOne" then
					table.insert(plrs, v)
					if #plrs >=4 then
						game:GetService("TeleportService"):TeleportPartyAsync(5693371661, plrs)
						num = 0
						workspace.Queue.Counters.Chapter1.PlayersInQueue.SurfaceGui.Players.Text = (num.."/8")
						game.ReplicatedStorage.Values.Chapter1Plrs.Status.Value = false
					end
				end
			end
		end
	end
end

Thanks :smiley:.

Can you try adding prints throughout your code? If you test it in game, it should work fine. You can also use a pcall before teleporting.

There is a high rate of failure in Roblox’s TeleportService. If OP uses a pcall and it still doesn’t work, it’s more than likely an engine bug, of course, the high rate of failure.e

Updated Script (Server):

local num = game.ReplicatedStorage.Values.Chapter1Plrs.Value
local plrs = {}

while true do
	for i = 30, 0, -1 do
		workspace.Queue.Counters.Chapter1.Chapter1Counter.SurfaceGui.TextLabel.Text = i
		wait(1)
		if i == 0 then
			for i, v in pairs(game:GetService("Players"):GetPlayers())do
				if v:WaitForChild("CurrentDoor").Value == "ChapterOne" then
					if table.find(plrs, v) ~= true then 
						table.insert(plrs, v)
						if #plrs >=4 then
							game:GetService("TeleportService"):TeleportPartyAsync(5693371661, plrs)
							num = 0
							workspace.Queue.Counters.Chapter1.PlayersInQueue.SurfaceGui.Players.Text = (num.."/8")
							game.ReplicatedStorage.Values.Chapter1Plrs.Status.Value = false
						end
					end
				end
			end
		end
	end
end