Player:LoadCharacter() causes server to completely Freeze for a few seconds

As I mentioned numerous times before, no scripts have been enabled in recent testing, so it’s not script related. I’ve updated the original reply to reflect this.

I found the exact source or at least sources of the problem, and it appears to just be this one individual frame element with it’s descendants.

image

I’ve decided to completely remove said element from the game, and recreate it while keeping a close eye on performance. Thanks everyone for the thoughts, but this does indeed resolve the initial problem.

(I’d like to note, all scripts in this UI element are disabled, and this UI went basically unused, and switched off, being made non-visible)

That shouldn’t affect the server though? Unless it’s rendered automatically on StarterGui.

Guis rendered on clients usually only affect gpu and cpu.

My Main Menu ui (that I enable when player joins and not have it automatically on) barely does anything to performance.
image

Could be the scripts, some ui elements can be very expensive, like updating UiGradients.

1 Like

I have absolutely no clue how it resolved it, but the server no longer spikes anymore, so it must have been just this one descendant. Nothing else seems to be causing it. Like I said, it’s very possible there is an underlying issue with the engine, and Instance.new or :Clone() going on here, which are both off topic to this thread.

The issue is resolved so I’m satisfied :sweat_smile:

As I’ve said many times before again, it is not scripts.

Speaking off which.

How do you handle loading character? Usually this is the only accepted method since it makes sure the character is destroyed and every connection assigned to it and children are too disconnected. (as long as theres no references.)

local Player1 : Player = game:GetService("Players").Player1 

Player1.Character:Destroy()
Player1.Character = nil
Player1:LoadCharacter()
1 Like

I use the Workspace property that automatically destroys previous reference to the Player/Character when they are destroyed. In this case, Character would not be memory leaking. I took this into account, and was very careful even from the start with how I wrote my code, which is why I was so confused with all of this.

I appreciate the support though.

Here is the announcement thread for the whole thing if you’re interested:

Have you read this?

1 Like

Please see the announcement I attached to my other reply. I apologize for posting it a little late after sending, but that property already deals with that issue automatically, as those other workarounds were made before this property was introduced.

But in short, this is what is important:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.