Sending data to other place when teleporting players?

How can I send some map data(basically I only need one string) when I teleport players to other place?
I want to get map data string that stores map values.
map data shouldn’t be editable in client because I don’t want exploits to change their map when they join

as example, main place sends players with map data (boss map1), and opened place has all maps and loads map that is wrote in sended string data.

1 Like

There are three methods: two available to you now and one coming real soon. They’re all in order from the best solution to arguably terrible.

First: wait for MemoryStoreService. The API is very similar to DataStoreService and will effectively supersede permanent DataStores for matchmaking and teleport data for most server use cases. I am in the closed beta but I’m not at liberty to discuss it in detail so wait for the announcement. What I am willing to say is that I LOVE MemoryStoreService for matchmaking, it’s a near-perfect solution. One of my top favourite Roblox updates thus far.

Second: if you’re using ReserveServer, then use the PrivateServerId as a data store key and save the data you want to send as a value. This is the way most experiences, as well as my own, currently handle matchmaking data like which map should be used at the target place. Think of it like saving player data except you’re saving a server’s data in the lobby place. At the arriving server, you just have to call GetAsync(game.PrivateServerId) to retrieve the server’s data.

Third: All teleport methods provide a TeleportData parameter. If you’re using the all-in-one TeleportAsync with TeleportOptions then it provides a SetTeleportData method. There is support for server-sided teleport data but I strongly dislike it. Data is transmitted with the client and exploiters can reuse data or call teleport on themselves and pass their own data, though it’d be irrelevant for a private server since exploiters can’t send themselves to private servers. The amount of work you need to put into fully securing teleport data alongside what the engine does is madness. See this post for information on how to do that.

11 Likes

2 weeks later, here we are with MemoryStore finally released. And I do share your “fascination” with that service. Especially us developers that have worked with matchmaking and real-time cross-server data storage - oh the pain, oh the memories.

This will hopefully, and most likely, be all resolved with MemoryStore. And I just wanted to ask you, since you have contributed with countless of high quality tutorials and resourced, if you have any plans of making a matchmaking module using MemoryStore?

You wrote on the announcement post:

Are you planning to make a cross-server matchmaking system in the future? This would help, hundreds, if not thousands of people on Roblox considering the vast amount of games currently implementing - or wanting to implement - cross server matchmaking. And since cross server matchmaking has been so unreliable we’ve finally gotten the solution.

So I just wondered if you were planning on something like that in the future. Thanks for reading, and as always big fan of your work!

1 Like

I’m currently experimenting with some cross-server matchmaking myself (I didn’t get around to doing that during the beta) and thought about writing a tutorial regarding the flow to help newer developers see how they can use this service to their advantage, but probably not a module.

Cross-server matchmaking is pretty much transferring your source of truth from a ModuleScript in-session to MemoryStore, so if you already know how to do matchmaking you’ll know how to use MemoryStore to get the same results. Something that may stump people is automatic matching though.

Indeed though, a few (top) developers have asked me some questions about MemoryStore so I can only imagine that smaller-name developers may have trouble conceptualising the workflow. I’ll see about a tutorial unless someone else has something in mind.

4 Likes

Thank you for answering, and sorry for my late response.

This is pretty much perfect. As people want to have different properties and characteristics with their matchmaking. So an explanation, as you mentioned, along with some code snippets and general tips regarding this will just be a godsend.

Exactly! Spot on.

This really says a lot. The top developers have access to lots of resources and help both internally and externally, and still, they struggle with it. I think both top developers, as well as the average Joe, don’t know:

  1. How to program it in general
  2. Caveats and proofing that every matchmaking system needs (such as backups if the teleport fails etc. etc. or something like that)
  3. How to best optimize it and functionalities it needs to have.
  4. And just a general lack of knowledge of how to communicate across servers. To understand this well, and make good cross-server matchmaking you need more than just general knowledge of Lua(U) but also knowledge of how latency works, the internet, etc. This is something a lot don’t have.

Anyways, thank you for everything you are doing and have done for the community. And really looking forward to a resource from you regarding MemoryStore! Sincerely :slight_smile:

1 Like

Is the second method using DatastoreService, MemoryStoreService, or TeleportService?

Either of the first two depending on how much permanence you need on the data - typically MemoryStoreService is enough since you can remove the key and cache the data in the server immediately after it spawns up. If you want players to join mid-round or anything, you might want to use DataStoreService instead or make sure you have enough memory store quota to use.

1 Like