While loops/RemoteEvents freezing server

I’m using RemoteEvents to send a player’s GUI drawing to other players in the game about every half second. Everything runs well for the first minute, but then everything goes downhill from there.

The whole server F9 console stops responding and doesn’t load Server Stats or the Server Console. The players board stops getting replicated to the other clients and my chat system that uses .Chatted doesn’t even work. Overall, nothing continues to work.

Everything else is confidential

It’s on your side, my whole game runs on two while loop polls firing remote events to the client every 0.1 seconds.

That means you’re firing remote events/functions too many times in a little amount of time. You can try only updating once a second or something like that.

99% sure this is a problem on your end

Now that I turned the loop wait time to 1 second, it still does the same thing.
I’ll investigate more into it.

Make sure you’re only sending updates and not replicating all the data. Every time I’ve run into a problem like this, that was the cause.

I’m pulling a gui with a ton of ImageLabels from the “drawing” player in the server, cloning it to ReplicatedStorage and then sending the reference to that model via a RemoteEvent to the “guessers”. Am I doing something wrong? Any suggestions on how to cut down and make the process more efficient?

I’m pulling a gui with a ton of ImageLabels from the “drawing” player in the server, cloning it to ReplicatedStorage and then sending the reference to that model via a RemoteEvent to the “guessers”. Am I doing something wrong? Any suggestions on how to cut down and make the process more efficient?[/quote]

Wow. No, no, no, no. Do not do that. That is a complete waste of network resources.

When your player clicks or whatever you’re undoubtably firing a DrawPixelAtThisPoint function. Have that function tell the server that a point has been drawn and then have the server tell the clients to update their canvases to include that point.

1 Like

Client:
ImageUpdate:FireServer(String labelimage, UDim2 position, UDim2 size(if the sizes aren’t standard))

Server:
imageupdate on server event
for player in pairs players:GetPlayers() and player ~= invoker
ImageUpdate:FireClient(player, labelimage, position, size)

client:
imageupdate.onclientevent
ilabel = Instance.new(“ImageLabel”)
ilabel.Image = labelimage; ilabel.Position = position; ilabel.Size = size

I guess I should rewrite my game’s backend since it’s all dependent on the game doing what I previously described. Pretty weak backend.