Character:Destory keeps spawning a copy into workspace

  1. What do you want to achieve?
    I have created a replace character script and it works for about 5-10secs

  2. What is the issue?
    The issue is when I destroy my current character and play as a new one, it only lasts for about 5 - 10 secs then I get respawned back into the workspace as my avatar. The workspace then has two copies of me but I can only play as one. Please see video
    Roblox Character Clone/Destory issue - YouTube

  3. What solutions have you tried so far?
    I have tried commenting out the script line by line but it seems like some sort of behavior issue

Here is the code

local CharacterClone = game.ReplicatedStorage.Characters:FindFirstChild("NPC"):Clone() 
CharacterClone.Name = player.Name
player.Character:Destroy()
player.Character = CharacterClone
CharacterClone.Parent = game.Workspace

Any Ideas?

Perhaps what you’re looking for is .CharacterAutoLoads, disabling it will prevent the game from automatically respawning the player whenever their avatar gets deleted

Thanks, that did point me in the right direction and i was able to create a server script that uses Autoload to false and LoadCharacter to spawn in once a humanoid has died.
However this only allows my default character to keep respawing.
Even though i set the parent to workspace of the clone npc model from Replicated storage, it won’t respawn upon death.

The spawn button is a local script and the Autoload script is server it should still work cause it’s checking for humanoid in workspace right?

game.Players.CharacterAutoLoads = false

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		-- find the humanoid, and detect when it dies
		character:WaitForChild("Humanoid").Died:Connect(function()
				player:LoadCharacter()
			end)
		end)
	player:LoadCharacter() -- load the character for the first time
end)

Is there any checks i can script to ensure the replicated storage clone respawns?

It is possible that your new character is dead, and the Roblox respawn system cleans it up and replaces it after 5 seconds?
I would make sure that there is a neck weld and that the humanoid has health.

I double-checked and can confirm that the new character does die with 0 health. The issue is when the new character health reaches 0 it doesn’t auto respawn with CharacterAutoLoads set to false.
However, my default avatar does. I did what you said and included a neck weld and confirmed health. Also confirmed it is being recognized as the player.

I have a new video to show the issue. I’m using the reset character for testing

I tried playing around with a few if statements to do something at 0 health but none worked so far
Example

		if (character.Humanoid.Health <= 0) then
			player:LoadCharacter()
		end

Also, should I be concerned it’s spawning at a custom location instead of the spawn point?

Edit: Upon further testing, I have found that when I spawn as the clone from replicated storage and reset character the ‘character:WaitForChild(“Humanoid”).Died:Connect(function()’ never fires
I however have, all the properties are the same as if it was the players character. Parent/Health. etc,

Upon testing again, I added a print(“has died”) to the Died connect function and it never printed when just the spawned character was reset. I also tested with a kill block and the spawned character doesn’t take any damage,
So i think the issue is that the spawned character is not being reconised as a humanoid even though i copied my default characters humanoid to the spawned character in replicated storage, once i switch it does have all the same properties but never takes damage

Does any know how this can be fixed?