Stop LoadCharatcer() from deleting old dead character

Im doing a simple spawning system, where the player press a button to spawn, and then the server calls load character on said player, making it spawn. After the player dies, I want the dead charater to stay as a corporse for some time, but when a player respawn, using the :LoadCharacter(), the old character is destroyed, as its says on the api, what i could do to prevent the old dead character from being destroyed?

3 Likes

Clone the dead character and strip it of its functional components

4 Likes
	local clone = char:Clone()
	clone:WaitForChild("Humanoid").PlatformStand = true
	for _, v in pairs(clone:GetDescendants()) do  --de todo los hijos y los hijos de los hijos y etc del character, osea GetDescendants()
		if v:IsA("Script") then -- si el desendiente es un tipo de Motor6D
			v:Destroy()
		end
	end
	char:Destroy()
	clone.Parent = workspace
	wait()
	-- humanoid bug makes parts that had can collide on false reset to false
	for _, v in pairs(clone:GetChildren()) do 
		if v:IsA("BasePart") and v.Name ~= "Handle" and v.Name ~= "HumanoidRootPart" and v.Name ~= "UpperTorso" and v.Name ~= "LowerTorso" then
			v.CanCollide = true
		end
	end
	game.Debris:AddItem(clone, Settings.CorspeTime)

thanks, this some how did the trick, i dont know why but humanoid cloning has some bugs

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.