I have a corpse script that basically clones all of the character’s descendants into a new model upon death. However, I am spammed with “Player:Move called, but player currently has no humanoid” error for the duration of the player’s death until respawn.
I’ve noticed that if I clone the humanoid or exclude it from being moved from the original model, the error disappears but leaves an unsatisfactory result in its wake (i.e. player’s camera does not drop to the floor where the body is).
So to my question: Is there a better method in creating a corpse system, or is there a way to solve this error/warning outright?
local CharacterChildren = Char:GetChildren()
local CorpseModel = Instance.new("Model")
CorpseModel.Name = "Corpse of " .. Player.Name
CorpseModel.Parent = workspace
for i = 1,#CharacterChildren do
CharacterChildren[i].Parent = CorpseModel
end
A better way to create a corpse model would be:
Note that I’m toggling the ‘Archivable’ because by default the player’s character isn’t archivable which means it can’t be cloned.
Char.Archivable = true
local corpse = Char:Clone()
corpse.Name = "Corpse of " .. Player.Name
corpse.Parent = workspace
Char.Archivable = false
--additionally you can set the original character's transparency to 1 to hide it
Issue with your code is that by reparenting the character’s parts, you reparent the player’s humanoid to a new model thus leaving their actual character without a humanoid, thus this error.
Yes that is correct. If you want to instead have a death animation, you could disable Humanoid.BreakJointsOnDeath, anchor the character, and play your death animation using a high animation priority.