How does one remove a player's character without throwing up ROBLOX errors?

Good day all,

I’m currently using this line to destroy the player’s character:

Player.Character:Destroy()

PROBLEM
This throws up a recursive ROBLOX script error pertaining to the Character.Humanoid’s :Walk() function being unable to execute due to lack of a humanoid.

GOAL
I would like someone to suggest an alternative method which doesn’t throw up this error and doesn’t respawn the player’s character. (so Player:LoadCharacter() is out).

Thank you.

1 Like

Do you want to delete the character when it spawns or do you want to delete the character for a different reason?

Uhhh, I don’t see exactly how that would impact the result, but I want to remove the player’s character when they press “m” (already programmed) and opens a menu.

The possible problem here is that you are deleting the character on the client. Your best bet is to send a remote event to the server to delete your character. If you want to keep the character stored somewhere to use later, you can move the character to a storage service and move it back when required.

10 Likes

Thank you, I have been trying to find a way to only spawn the player when it is called upon