Struggling when send table to global by using MessagingService

Hi im struggling when send table to global rn

Send table to global:

function Party.SendToGlobal(tables, status)
	if status == "Add" then
		messgagingService:PublishAsync("Matchmaking", PartyIntermission[tables])
	elseif status == "Remove" then
		messgagingService:PublishAsync("MatchmakingRemove", tables)
	end	
end

SubscribeAsync to global:

messgagingService:SubscribeAsync("Matchmaking", function(message)
	table.foreach(message.Data)
	table.insert(GlobalMatchmaking, message.Data)
end)

message.Data return me table, after use foreach to print it, it still return table

I don’t think that that is the correct usage of table.foreach()


It appears you need to provide a function that handles the information in the table
for example:

table.foreach(message.Data, function(key, value)
    print(key, value)
end)

oh ok i will try it when at home! thanks for help

ah ik why rn it table.foreach(message.Data, warn) not table.foreach(message.Data) mb

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.