TeleportToPrivateServer Parameters

Let’s pretend that I want a group of players to teleport to a private server, but not necessarily spawn right away. In this case, I don’t really have a (string spawnName) parameter that is necessary.

Would it be okay to do something like this?:

TeleportToPrivateServer(12345, 123, players, nil, data_table, nil)

I filled in the empty parameters with nil.

Link to the API article

1 Like

No, use the normal function then apply a script in the private server to withhold spawning the character.

I am making a temporary private server (one that will be created and then abandoned after like 30 minutes or so)…

The only parameters that I care about is: the place ID, Access Code, Players, and Teleport Data.

" An optional spawnName parameter can be provided" ~ API
If I don’t want to use this parameter, do I just insert “nil”?

This is something you can test yourself. Passing nil is fine, it’ll just consider that argument as none.

SpawnName is an optional string: what it essentially does is gather all existing SpawnLocations in the place and traverse them. If a SpawnLocation matches the passed name, that’ll be what spawn your character spawns on after the completion of the teleport. The name property of Roblox instances cannot be nil. AFAIK a nil value just skips dealing with spawns.

Passing nil does not stop immediate spawning after teleporting as it is merely an identifier string. Stopping immediate spawning after teleporting is a case you need to handle yourself at the target place.

3 Likes

Thank you @colbert2677 for the clarification. I’ve been pressed for time (for game development) this week, meaning that I have little to no time to test cross-server communication (in this case, teleportation stuff), and I really appreciate your time invested into this topic :sunny: