Context
My own game started having extreme ping and crash issues at the beginning of the week within client. Due to the game not being public, I only noticed this bug monday but it could have been an issue for longer. This bug was tedious to diagnose and basically make my game completly unplayable online.
When using a simple GetAnimationTrack function on the client side for the local player’s character on a large amount of animation over a whole game. The function seems to start generating high amount of ping and the “Player appears to be spamming remote events” message starts appearing in the server’s console. At the same time, this problem only occurs on the live client and not within studio.
Here the common “GetAnimationTrack” function used.
function GetAnimationTrack(Animation: Animation)
local Char = game.Players.LocalPlayer.Character
if not Char then return end
local Hum = Char:FindFirstChild("Humanoid")
if not Hum then return end
local Animator = Hum:FindFirstChild("Animator") :: Animator
if not Animator then return end
for _,v in Animator:GetPlayingAnimationTracks() do
if v.Animation.AnimationId == Animation.AnimationId then
return v
end
end
return Animator:LoadAnimation(Animation)
end
Video of repro
Place showing off the issue: Animation related bug causing high ping - Roblox
Place’s file: Animation Related Bug Causing High Ping.rbxl (83.8 KB)
The textbox allows input the amount of calls to random animation of this function to be performed per frame.
For the need of this repro file, I’ve scrapped a lot of UGC animation to simulate a game with high amount of different animation.
Expected behavior
I’ve used this function for literal years and I never had this issue until now. It shouldn’t produce the “Player appears to be spamming remote events” within the live game.
If it ends up being a bad practice, could we atleast have a similar issue happen in studio too?