For some reason :SubscribeAsync() runs multiple times?
I did not run PublishAsync 2 times. I only ran it one time.
“sent” prints out 2 times (without the check) after the check it still prints out two times.
My game had 2 servers running.
function isEqual(table1, table2)
if _G.request == nil then return false end
if table.getn(table1) ~= table.getn(table2) then return false end
for i,v in pairs(table1) do
if table1[i] ~= table2[i] then return false end
end
return true
end
Players.PlayerAdded:Connect(function(player)
-- Subscribe to the topic
local subscribeSuccess, subscribeConnection = pcall(function()
return MessagingService:SubscribeAsync(MESSAGING_TOPIC, function(message)
print("sent")
message = message.Data
if isEqual(_G.request, message) == true then return end
-- and further on..