I made a system that uses MessagingService to send over player position data to essentially allow for cross-server.
My current problem is that I’m hitting the publish limit when I think I shouldn’t be, and I don’t know what I’m doing wrong.
Right now, my experience is 1 player, and 1 server uses 42 requests per minute. The requirements scale dependant on how many servers are active, so from what I’ve understood, I shouldn’t be hitting the publish limit, but I still am, so maybe I’m missing something?
(I know the requests and the wait dont match here but that’s because I also included the chat requests (so the additional 12 is if ur chatting for a full minute)
If you’d need a snippet of my script: (excuse the messiness and generally dumb practice, i was just writing just to get results)
-- UpdateCharacterWaitTime = 2, by the way
while task.wait(UpdateCharacterWaitTime) do
Updt += 1
local all = {}
local Return_Data = Remotes.Connection:Invoke()
for i,v in Players:GetPlayers() do
if v.Character and v.Character.PrimaryPart then
if #Return_Data == 0 then
table.insert(Return_Data,tostring(v.Character.PrimaryPart.CFrame))
end
table.insert(all, httpservice:JSONEncode({ServerID, v.UserId, httpservice:JSONEncode(Return_Data)}))
end
end
if #all ~= 0 then
local success, result = pcall(function()
return MessagingService:PublishAsync("UpdateLocations", httpservice:JSONEncode(all))
end)
if not success then
print(result, #Return_Data)
end
end
end