Huge client lag because of loop setting textchatservice functions

local runserv=game:GetService("RunService")
local textchat=game:GetService("TextChatService")

runserv.PreAnimation:Connect(function()
	textchat.OnIncomingMessage=nil
	textchat.OnBubbleAdded=nil
	textchat.OnChatWindowAdded=nil
end)

step 1: Empty baseplate only put the above LocalScript in ReplicatedFirst
step 2: Publish to roblox
step 3: Join and wait at least 2 minutes for the network ping spikes to happen

Same thing reproducable in studio if you loop set RBXGeneral.ShouldDeliverCallback to a function that always returns true (on serverside script but still its reproducable in studio u can see it starts sending a lot of crap in the network)

Expected behavior

Roblox shouldn’t waste my bandwith just because i decided to loop set some functions to nil and same applies to on serverside RBXGeneral.ShouldDeliverCallback shouldnt lag my studio instance when loop setting it to a function that always returns true

Why are you even doing this?

You are setting server to client callbacks to nil every frame, there’s no doubt that this will be expensive. If you do want to set these callbacks to nil (which they are by default), just set it once for the player or after a specific event is called. There’s no reason to do this every frame.

textchat.OnIncomingMessage=nil
textchat.OnBubbleAdded=nil
textchat.OnChatWindowAdded=nil

they are all clientsided and they have no reason to be wasting my network resources you cannot even set these functions on serverside so i find it strange that they cause network lag when in a loop

also RBXGeneral.ShouldDeliverCallback is on serverside only but it still does create network lag but only on serverside not the clients anymore if looped

These callbacks are called when a message on the server is distributed to the client, which is what I meant. I don’t think you should be setting callbacks every frame anyways.

its still a huge flaw because i can loop set RemoteFunction.OnClientInvoke and that doesn’t waste my network bandwith

yet textchatservice ones that act almost 1:1 as RemoteFunction.OnClientInvoke will cause network lag if looped

thats why i find it strange that these client functions are causing this to happen except RemoteFunction.OnClientInvoke

I would assume they aren’t truly client-sided, but can only be set by the client, which is weird, but in-line with other TextChatService functionality.

1 Like