Version 2 has been released! Because no features were brought up since I asked, this update mainly just includes the change from teleport data to another memory store for security purposes. Explained here
Version 2.0.0
Changes (breaking):
[Removal] Removed all teleport data.
[Addition] Added MatchmakingService:GetCurrentGameCode(). This will get the code of the current game, if it is a game server, nil otherwise.
[Addition] Added MatchmakingService:GetGameData(code). This replaces the teleport data for game data. This will include the game’s code, rating type and any custom data you apply with ApplyGeneralTeleportData. You can call this without code, if so MMS will use the use GetCurrentGameCode().
[Addition] Added MatchmakingService:GetUserDataId(player) (and MatchmakingService:GetUserData(player), accepts player rather than player id). This replaces teleport data for players. Use this to get any data you apply with ApplyCustomTeleportData.
[Change] RemoveGame(gameId) is now called automatically on game close and will no longer accept a gameId parameter. This shouldn’t be called anymore, as MMS will handle it for you.
Changes (non-breaking):
None
Fixes:
[Fix] Custom user data is now applied when teleporting to existing games.
Remember you can still obtain version 1 with local MatchmakingService = require(7567983240).GetSingleton({["MajorVersion"]="v1"}) so that you can choose when to update your games! However, version 1 will not receive any new updates.
For v2.1, can we have the ability to set our own TeleportData? It would help with backward compatibility with Bloxy Kart’s existing Multiplayer system, and all we would need to do is add this into our game.
With it being fully server sided, exploiters can’t modify the data at all (unless, of course, you’re calling a remote function when setting the data which I will say I don’t recommend).
This is a bit late, but TeleportData can be made secure easily:
Obtain it with Player:GetJoinData()
Check if JoinData.SourceGameId == game.GameId
When creating the TeleportData on the origin server, add the current os.time() and check on the destination server if os.time() - JoinData.TeleportData.Created < 20
TeleportData is actually nicer to use sometimes, since it doesn’t consume memory.
Thanks for making this module! This module will be used in Bloxy Kart for its v4.0 update.
I have a few suggestions:
for the FoundGame event, can a parameter be a table of players Usernames, User ID, and Display Name? I kind of want to show an icon of the player when the game is found along with who they will be racing with, and more info (For example, how many wins they have, and what kart they have equipped)?
Also, can there be an option for SetPlayerRange to set on all maps? I don’t want my code to be doubled as long, even though we can still do this:
local RaceMaps = {
"Under_The_Sea",
"Small_World",
"Jurassic",
"Piggy_Speedway",
"Sandy_Secrets",
"Space_Heights",
"Space_Highway",
"Eggsburg",
"Tilted_Road",
"Space_Turnpike",
"Grassy_Ventures",
"Mushroom_Forest",
"Willis_House",
"Santas_Village",
} -- Oops, Might of exposed some maps that are in the games code that are unused. Thats ok...
for _, Maps in pairs(RaceMaps) do
MatchmakingService:AddGamePlace(Maps, 9130693906)
MatchmakingService:SetPlayerRange(Maps, NumberRange.new(2, 8))
end
MatchmakingFolder.AddToQueue.OnServerEvent:Connect(function(Player, Map)
local GameData = {Map = Map, Gamemode = "Multiplayer"}
MatchmakingService.ApplyCustomTeleportData = function(player, gameData)
return GameData -- Here is where I am putting the Data
end
MatchmakingService:QueuePlayer(Player, "Player", Map)
end)
I have been messing with the script above for the past couple of hours, and I am not getting it. I looked in the Module and saw that ApplyCustomTeleportData is not a function, which also makes me believe it is a bug, and it is hidden in MatchmakingService.new(). Would appreciate help!
You can iterate over the players table and get their display name/username. I don’t do this natively because that’s a lot of extra bandwidth/api calls for a lot of people that wouldn’t use it
to retrieve the map. This is a little cumbersome though and I can look into a better way to do this that isn’t as long. As for why it’s not working for you right now, I can only assume it’s because a callback function is supposed to be set a single time, not multiple times for every user.
How can i detect game is removing? And new game is added because i want to create a serverlist that updates instantly. Also how can i pass the game password to the hub if there is a no messaging service?
Currently there is no event for adding or removing games which is fired globally. I can look into adding this next update if you want this functionality. Also there is no real way to password protect servers, that’d be more akin to a server browser, not a matchmaker. A matchmaker finds games without having to search through a server browser based on how many players are in the queue. There is, however, a way to add custom game data which could include a server password, and then to lock the server from joining without being manually added, but this functionality, currently, does not exist in the vanilla service.
Hey, im back to report an error. I am still using v1.3.2 because I didn’t know about the new updates and I spent a long time migrating to JoinData which I would now have to revert : (
In basically every server I get this error. I’m not sure if this is a roblox error or something to do with MMService.
It started happening about 1 week ago, but now is constant.
If it happens everywhere memorystore is called I would think that it’s a roblox issue (and you didn’t update so it just came out of no where), however the first think I would try is to open your console in a game then type require(path.to.MatchmakingService):GetSingleton():Clear() where path.to.MatchmakingService is the same way you require it anywhere else.
Another question that I have, is this going to be fast? Does this use or can we use the same system TDS uses for matchmaking? Which is where it would get the closest players to you.