"Unable to cast value to Objects" from TeleportPartyAsyns

This is what I’m getting…

…when this function runs…

function launchDanceRoom()
  print(players)
  game:GetService('TeleportService'):TeleportPartyAsync("6103271639", players)
end

players is a table of Players marked with a SelectionBox. It has all keys set to strings, using the player’s name. You can see the content of the table in Output

The place ID is for a place in the same game.

What do I need to change? TIA

It’s an array of Player objects, so your keys must be numeric, starting with 1. Just use table.insert to populate the table.

I don’t think it makes a difference, but the place ID should also be a number, not a string.

2 Likes

Thanks. That worked.

I think I misread a note in the API doc about teleportdata being a table with strings or integers as keys, as if it was talking about the players.

1 Like