How complicated is teleportservice?

So on Roblox I know you can like teleport players between games and servers with teleportservice I think? The only issue is I have no idea how this works and I feel like it’s complicated especially with what I’m trying to do…

So basically I have a 1v1 fighting game and so I have my game set to 2 players per game but if I use teleportservice I assume I can make the main 1 player per game and then in that game it will only have the different menu screens and then once the player selects a character I can make a match making script(?) which would I guess get another player that is also ready in another server and then teleport those 2 players into the place where they actually fight so it would just be like a stage and the points and like some other stuff.

The only issue then is how would I remember what the player selected as there character and how would I like make sure they have there abilities and stuff like that unless I can send stuff over?

Anyways how complicated would this be or is it kind of simple?

Not sure what you’re talking about but you can limit the max number of players in a server.

You can use the teleportData parameter to transfer data through TeleportService:GetLocalPlayerTeleportData .

In regards to your 1 player per game system to match make:
This wouldn’t work without using the messaging service which to be quite honest would be a whole heap of problems. The messaging service has limitations and you’d have to handle circumstances of things not working right.

With the teleportservice, you can either send people to a private server or to another server - but it doesn’t do matchmaking. The servers don’t talk amongst each other unless you use the messaging service - the teleport service is just there to facilitate the teleport. The easiest way of doing your matchmaking would be to have a 50 player lobby, and then matchmake the people who are ready to play.

In regards to your sending data over:
Method 1 would be to include it in the teleport arguments and handle it based off that information.

Method 2 is if you have a save system for characters, you have the lobby with commands to manipulate the data. And then the secondary game basically reads and handles the data.

I wouldn’t say this is complicated, its just long and will require a lot of research and application.

1 Like

Ok so basically it’s easier to just have my game set to 50 players ok so if I do this that means I’ll have multiple matches able to happen at once in a game and my current game loop or matching making I don’t think can handle this lol.

Basically right now after the player selects a character I add them to a table and if the table is less then 2 then it waits until another player picks a character and then gets added to the table and then game starts.

What if I had 4 players though? How would I run the code again, but for the 2 other players you know what I mean? I’d have to be able to start a new match and also like change the location of the map so it doesn’t overlap with the first one and I’d also have to make sure that the the first game that’s happening isn’t effecting the second game so if someone wins in the first match and it ends it doesn’t also end the other match idk if that made sense, but yeah lmao.

p.s: my code isn’t really efficient and that well made so it kind of breaks easily a lot of the times ooof.

Like @XxELECTROFUSIONxX said, you can transfer data when they get teleported using TeleportService:GetLocalPlayerTeleportData (which is one-way communication).

which would I guess get another player that is also ready in another server and then teleport those 2 players into the place where they actually fight

If you need to send data back to the server that teleported you, you’ll need to use MessagingService (https://developer.roblox.com/en-us/api-reference/class/MessagingService). One thing you have to be careful about is not hitting the limits outlined in the article.

The two functions that you’ll need to use are SubscribeAsync() (receive messages from other servers) and PublishAsync() (send messages to other servers)

1 Like

Multiple matches at once? No, you just matchmake in a lobby game and then send them to a completely separate game in the same universe so its private.

You would just add conditions to check if a matchmaker can continue or not based on the number of players in the lobby in comparison to the max number of players to start (the moment a player joins).

Can you explain this? I’ve never done this kind of stuff before so this is all new to me

You can use this alongside ReserveServer:
https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPrivateServer
https://developer.roblox.com/en-us/api-reference/function/TeleportService/ReserveServer

1 Like

So I’d make the main game hold like 50 players as you said and then I’ll just wait until 2 players are ready and then I can send them to the reserved(?) place where they can fight right? And can I send multiple people to the place and it’s going to make multiple servers like a normal game would or do I actually have to make like multiple places.

Also sorry I keep asking these long questions, but for sending data over I can send this stuff (from what I’ve read)

  • A table without mixed keys (all keys are strings or integers)
  • A string
  • A number
  • A bool

So if I have like a string that’s holding the name of the players selected character I can send over to the teleported place what character they are? Because as long as I can do that I think I can manage to get this to work because my code kind of relies on knowing what character the player is.

Nothing is complicated, it just feels like it until you realize how easy it can be if you put effort into it.

When reading about TeleportService on the Roblox API, make sure you understand what’s being said and practice.