Players stuck on respawn screen
Players are randomly unable to respawn immediately after dying; occurs randomly. Here is the console error:

AssertionException: Assertion failure. Value was False

Expected: True

Stomping old lifeStory

I found the following thread and came up with the solution to just parse server entities and delete the 'duplicated' player - which works after manual deletion. However, I am searching for a solution to what is causing this issue to prevent it altogether. Here is the code I am using when OnPlayerDie is called:

private void OnPlayerDie(BasePlayer player, HitInfo info)
{
    var npc = player?.GetComponent<NPCPlayer>();
    if (npc) return;

    var p = checkAndReturnInstancePlayer(player.userID); //RETURNS BASEPLAYER
    if (p == null) return;

    if (p != null)
    {
        timer.Once(1.5f, () => {
            if (player && player.IsConnected)
            {
                player.RespawnAt(new Vector3(1, 1, 1), new Quaternion(0, 0, 0, 0));                                                
                player.EndSleeping();
                player.inventory.Strip();
            }                       
        });
    }
    return;
}


I was using NextTick() before switching it to timer.Once() but the same issue is still occurring - no other code from any other plugins are using this hook other than this. Any help seriously appreciated

  1. I believe there is an IsNpc method (unsure) or similar you can check instead of using GetComponent
  2. Why are you trying to find the BasePlayer hwen you already have the BasePlayer?
  3. You may be trying to end sleeping too fast after triggering a respawn, but unsure if that would cause this
You're right there is an IsNpc method that works thanks. It's unnecessary to find the BasePlayer in that method but it checks a class to make sure the data is populated for my own sanity. I will add a delay to end sleeping and see if that works. If I find a fix I will post it here