TeleportService - Invalid Argument #2 (expected string, got table) fix?

Can anyone help me fix this error, its on the TeleportPartyAsync line, the error is in the title. I’ve tried way too many fixes and searched around everywhere, but couldn’t get it to teleport the players in the same lobby.

local t = {}
local function onTeleportFired(player)
	print("teleporting "..player.Name.."'s party")
	local children = workspace.Parties:GetChildren()
	for i, child in ipairs(children) do
		if child.Players[player.Name] then
			local partyName = child.Name
			local children2 = workspace.Parties[partyName].Players:GetChildren()
			for i, child2 in ipairs(children2) do
				print("startMatch l37 "..child2.Name)
				table.insert(t, child2.Name)
				print("startMatch l39 ")
			end
		end
	end
	print("l43 startMatch ")
	TS:TeleportPartyAsync(9758723522,t)
end

is this teleporting to another experience or the somewhere in the same experience? if you’re teleporting the players to somewhere in the same experience use the CFrame from the HumanoidRootPart

its teleportservice so of course its to another experience.

whats confusing me is that it is supposed to get a table as the second param

they haven’t defined the TeleportService aka TS

I have, its just above the code since i thought it would be obvious that i defined it.

Its teleporting to another place that is just a place of the same experience.

ok I see the problem you are inserting the players name into the table instead of the player instance. you need to insert a player instance not their name.

so something like

table.insert(t, game.Players:FindFirstChild(child2.Name))

Thanks so much!
charactersssss

1 Like