Remote Event is receiving different data than what the server is sending

I’ve been experimenting with making a system that can handle a huge amount of projectiles without much lag, and I’ve been having a decent amount of success but suddenly ran into a problem where the dictionary of projectiles the client receives from the server does not match what the server is sending. I tested this by having the server print a dump of its projectiles and the client printing its own dump once it receives the information and comparing the two printouts, only to find that the last few members of the dictionary are missing from the client’s point of view.

CLIENT CODE

cremotes.UpdateProjectiles.OnClientEvent:connect(function(newdata, servtime, projectilesout, pvpon, dumpid)
	table.insert(times, servtime-time())
	if #times>10 then
		table.remove(times, 1)
	end
	local sum=0
	for _, peeps in pairs(times) do
		sum=sum+peeps
	end
	sum=sum/#times
	servertime=sum
	projectils=newdata
	pvp=pvpon
	
	cutoffdist=300
	if projectilesout>600 then
		local cutoffmult=(projectilesout-600)/600
		if cutoffmult>2 then
			cutoffmult=2
		end
		cutoffdist=300-125*cutoffmult
	end
	
	local tot=0
	print("CLIENT DUMP", dumpid)
	for index, peeps in pairs(newdata) do
		tot=tot+1
		print(index)
	end
	print(tot, projectilesout)
end)

SERVER CODE

dumpid=dumpid+1
print("SERVER DUMP "..dumpid)
for index, peeps in pairs(projectiles) do
	print(index)
end
cremotes.UpdateProjectiles:FireAllClients(projectiles, time(), projout, false, dumpid)

The problem is in the projectiles dictionary, named newdata on the client and projectiles on the server. I’m wondering if there’s any conditions that would cause a Remote Event to not send all the information that’s packaged within it.

2 Likes

I’ve attached the dumps here dumps - Pastebin.com

1 Like

After a lot of searching, it seems that if there are large gaps in indexes when a table is sent from the server to the client, however ROBLOX packages the data causes anything after the gap to be dropped. Fixed by filling gaps in the table with a garbage value that is then removed from the client’s table.

1 Like