Error with MessagingService - does anyone know how to fix?

Hi everyone,

Thanks for taking the time to have a look at this for me -
I’m currently doing a server-wide matchmaking system, which is working fine however I’m having an issue with MessagingService when using PublishAsync, but I can’t figure out what the error is.

Below is the in-game error I receive, which I understand as there not being a parameter for the Topic of publishasync.

This is the code -

		local function StartMatch(Players)
			local ServerC = TeleportService:ReserveServer(BattleRoyaleMap)
			print("Starting  match...")
			for i = 1, #Players do
				print(Players[i].Server)
				print(Players[i].userId)
				local OldServer = Players[i].Server
				local ConvertedData = HttpService:JSONEncode({userId = Players[i].userId, Server = ServerC})
				print("Sent teleport message to player with userid "..Players[i].userId)
				MessagingService:PublishAsync(OldServer, ConvertedData)
			end
		end

Players is a table taken from the global-queue system, that table has 2 parameters for each value, so each table value has both a userId and a Server id, punctuation and wording is all correct as I have checked twice.

Anyone have any ideas as to whether I’ve made a silly mistake or anyways to fix this error?

1 Like