[v2.1.0] MatchmakingService - ON HOLD

I wish :AddSync returned an ID it would help alot

They won’t because it use UpdateAsync

what uses :Updatesync? wym
wwww


I dont understand why this is happening

Is there a way to delay the teleport for a few seconds? I’d like to give everyone a 5 second heads-up when they’re about to be teleported.

Yep there is
matchmakingservice:SetFoundGameDelay(newValue)

This service is kind of confusing to be honest. Like the example above.

What’s with the if winner == 1 then 1 else 2, if winner == 2 then 1, else 2 ??

i agree thats very confusing and kinda stupid

he could have done something like this on the backend to avoid such things as these

(this is just example)

--whatever "t1" is i dont know and i dont care cuz i never used this community resource ever in my life
function MatchmakingService:UpdateRatings(ratingType,winner,t1)
       local win=winner[1]
       if win==2 then
              win=1
       elseif win~=1 then
              win=2
       end

      --do whatever this function is supposed to do
end

then we use the function like this after update:

function EndGame(winner)

MatchmakingService:UpdateRatings(gameData.ratingType, {winner}, {t1, t2})

for i, v in game:GetService("Players"):GetPlayers() do

-- You can teleport them back to the hub here, I just kick them

v:Kick()

end

end

is it possible to connect SetFoundGameDelay to a function? I want to fire a remote to anyone being teleported giving them a 5 second countdown before the teleport starts.

would something like this work?

MatchmakingService:SetFoundGameDelay(5, function(player, gameCode)
print("Match found for "…player.Name)
ShowMatchFoundMsg:FireClient(player)
end)

I believe there are signals you can connect to in the module, I use that but not sure if it still exists in v3. Read the source code, you’ll probably see it in there I forgot lol

I found this, but when using it in combination with SetFoundGameDelay, it also delays the FoundGame function by the same number. I wanna check when the player has found a match, send a remote to them, wait 5 seconds, then start the teleport

I believe that the event you are referring to is in V3, are you using that or V2? (The versions are wildly different in my testing, and I believe both versions need a ton of repeat-until-pcall-success wrapping so that it doesn’t break other scripts on error)

Depending on player count, you might find it easier to process things like this with an external server (completely up to you though, also this is just based off personal experience with using external servers for a lot of things Roblox can’t do). Using an external server would be quite a bit slower (I think), but with the Open Cloud Messaging Service API it would still be pretty quick. I made a module that handles the whole HTTP/Messaging Service stuff if you are looking into that.

I’m not sure, I’m mainly just following the documentation

Also it’s worth mentioning my game is in an extremely early prototype-state, so not everything is wrapped in a pcall, but I am working on it.

I’m not too interested in using an external server, since I believe it goes outside the scope of the game.
Thanks for the advice though!

1 Like

By pcalls, I meant the module needs them because in my testing there was a lot (I mean a LOT) of errors that were just service errors. Otherwise, good luck!

Any progress on it? Sorry for the bump. Btw I was a bit confused on how to add custom player data to teleport

1 Like

Hi! You’d use ApplyGeneralTeleportData for general game teleport data and ApplyCustomTeleportData for players

local MatchMakingService = require(ServerStorage.Modules.MatchMakingService).GetSingleton()

-- Modules
local TableUtil = require(ReplicatedStorage.Modules.TableUtil)
local GameData = require(ServerStorage.GameData)

--- Variables
MatchMakingService.ApplyGeneralTeleportData = function(map)
	local GameData = TableUtil.Copy(GameData, true)
	return GameData
end

MatchMakingService.ApplyCustomTeleportData = function(Player)
	return {}
end

on the game server, you’d use MatchMakingService:GetGameData() for game data and MatchMakingService:GetUserData(Player) for players respectively

I would love to know if this module will be updated someday, especially now that hash maps are released

1 Like

Fixed a few indexing errors on the code.

On setting map roles there was an error when trying to check the maximum number of players.

before:

if newMapRoles.Max > 100 then
 
end

after:

function MatchmakingService:SetMapRoles(map: string, newMapRoles: MapRoles)
	for role, range in newMapRoles do
		if range.Max > 100 then
			warn(`{role} | Maximum players has a cap of 100.`)
		end
	end
	
	self.PlayerRanges[map] = newMapRoles
end

and when calling StartGame Function there was an error index nil joinable

function MatchmakingService:StartGame(gameId: string, joinable: boolean): boolean?

This line here:

_gameData = getFromMemory(JoinableGamesMemory, gameId, 3) or _gameData
_gameData.joinable = false

Set it to where when there’s no _gameData we just create a new table. Then adding the joinable key to false

_gameData = getFromMemory(JoinableGamesMemory, gameId, 3) or {}
_gameData.joinable = false

does the party matchmaking works well?

1 Like

I’ve personally had some issues with receiving the party array at the beginning of a match. It seems to work better when less people are active but doesn’t scale well from what I can tell. Not sure if my implementation of it is bad or not though.