Game lags when a player dies/resets/etc

I have tried everything from other devforum articles such as:

and many more.
However, none of these have worked for me.
I have no loose humanoids, no while trues, and it still lags when the player dies.
If you know any other optimization methods, please let me know

TLDR: it works fine in solo playtesting in studio, but when we do a teamtest or play in roblox when one person dies the game freezes for some seconds, please let me know any ways to fix it


Do you have a lot of Humanoid.Died events or Player.CharacterRemoving events connected to callbacks?

And CharacterAdded events…

He mentioned it was exclusively when a player dies/resets but if the respawn time is 0 then yes CharacterAdded events could also be contributing to the observed lag.

ill check for those, might have them. I only think i have 1 but i could be completely wrong

and theres 1 result for the .died function, but this is just to remove the viewmodel when a player dies, as i move it to the workspace so it is visible


Even if you have 1, lack of disconnections can make a lot of events overlap and cause lag.

what do you mean by a lack of disconnections? not sure i’m following

If the :Connect() is used in a script that runs multiple times in the same environment, you need to Disconnect it in order to prevent lag.

ill look up some doccumentation, that could be the reason because i dont think i have ever heard of it

edit: found it Events | Roblox Creator Documentation

1 Like

I have just tried this, and it still happens
what i did:

for each :connect() i made it a variable and when the player dies it disconnects all of them, and the stuff all still works, but when you reset or die by other means it still lags, did i do something wrong doing it like this or is this how it should be?

editing quick to say that im going to take a while to try to figure it out by process of elimination

wow im an idiot.

alright i figured it out, one unneeded script was causing it for some reason, fixed it now



script.Tool.Handle.Anchored = false

script.Tool.Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent