Help with TeleportScript

So I’m trying to make a teleport script and send the player’s health so they have it in the new place.
I wrote this ServerScript:

local teleportService = game:GetService('TeleportService')
local code = teleportService:ReserveServer(5844872161)
game.ReplicatedStorage.TeleportTime:FireAllClients()
for _, player in pairs(game.Players:GetPlayers()) do
	coroutine.resume(coroutine.create(function()
		local teleportData = {
			health = player.Character.Humanoid.Health,
			backpack = player.Backpack:GetChildren()
		}
		teleportService:TeleportToPrivateServer(5844872161,code,{player},teleportData)
	end))

end

It doesn’t work. Nothing happens. The gui fades in, but doesn’t teleport! Thanks for any help, there are no errors!

can you put some print statements in, and see where they don’t fire?

Changed the script to this:

for _, player in pairs(game.Players:GetPlayers()) do
	spawn(function()
		local teleportData = {
			['health'] = player.Character.Humanoid.Health,
		}
		teleportService:TeleportToPrivateServer(5844872161,code,{player},teleportData)
	end)

end

Now I’m getting a new Error:
image

@Wertyhappy27

I can help narrow it down, but can’t help with full code since my skill lacks, anyways, looking over that, and the error, try looking at this post, hopefully, that can help you a bit. Only saying that since they have the same error, not with tp, but something else, hopefully it helps.