#LoadCharacter() not working,

1 messages · Page 1 of 1 (latest)

brave swallow
#
  Players.PlayerAdded:Connect(function(player)
      player:LoadCharacter()
      CFrames:spawn(player)
          
      player.CharacterAdded:Connect(function(character)
          local humanoid = character:WaitForChild("Humanoid")

          humanoid.Died:Connect(function()
              task.wait()
              player:LoadCharacter()
              print("1")
              player.CharacterAdded:Wait()
              print("2")
              CFrames:reset(player)
          end)
      end)
  end)

Wehn i reset for the first time it does'nt print anything at all.
Wehn I reset for the second time it prints "1".
Wehn I reset for the third time it print "1,2".

Why does it work only after reseting 2 times?

#

nvm i solved this diffrently

faint hamlet
#

not the best solution but a solution

#
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local Humanoid = Character:WaitForChild("Humanoid")
        
        task.spawn(function()
            Player.CharacterAdded:Wait()
            print("Character respawned")
        end)
        
        Humanoid.Died:Connect(function()
            task.wait()
            Player:LoadCharacter()
            print("Loaded character")
        end)
    end)
end)
brave swallow
#

I found out you can set the RespawnTime in Player Service so this aint even needed

brave swallow
#

Way better