Double Checking if I did anything wrong(messageservice)

Did I do anything wrong here

Part doing the messageservice

local toshare = {}
	local message = game:GetService("MessagingService")
	while true do
		if not isgame then break end
		if #toshare >= 1 then
			task.wait(5)
			local status, w = pcall(message:PublishAsync("OperatorSignal", toshare))
			if not status then
				warn(w)
				task.wait(1)
				local s, w = pcall(message:PublishAsync("OperatorSignal", toshare))
				if s then
					toshare = {}
				else
					warn(w)
				end
			else
				toshare = {}
			end
		end
	end
	message:SubscribeAsync("OperatorSignal", function(shared)
		for _,id, value in pairs(shared) do
			if LocalSignals[id] then
				LocalSignals[id]:Fire("Game", table.unpack(value))
			end
		end
	end)

part setting

local id = "Send"
function(...)
toshare[id] = {...}
end
1 Like

but ar u having any problem with it? if not that fine while is not making memory leaks and lags

Right now I cant test it so I was wondering if it had something I need to change