Hide health bar from clonechar and player parts when it die

How could i hide those two things? CloneChar → Health bar and player parts when die?
Hello! I would like to know how to hide these two things when player die, could someone help me with that, please :frowning:

image

Code → ServerScript

-- Set CharacterAutoLoads to false
game.Players.CharacterAutoLoads = false

-- Remove player's character from workspace on death
game.Players.PlayerAdded:Connect(function(player)
	while true do
		local char = player.CharacterAdded:wait()
		char.Humanoid.Died:Connect(function()
			-- COPY
			char.Archivable = true
			local ClonedChar = char:Clone()
			ClonedChar.Parent = workspace
			
			-- I NEED IT HERE
			
			wait(10)
			player:LoadCharacter()
		end)
	end
end)

-- Respawn all dead players once every 10 seconds
while true do
	local players = game.Players:GetChildren()
	-- Check if each player is dead by checking if they have no character, if dead load that player's character
	for i, player in pairs (players) do		
		if (not game.Workspace:FindFirstChild(player.Name)) then
			player:LoadCharacter()
		end
	end
	-- Wait 10 seconds until next respawn check
	wait(0)
end

For the healthcare, try changing this property if the humanoid. Then for the parts, maybe try this?

game.Players.PlayerAdded:Connect(function(player)
       local character = player.Character or player.CharacterAdded:Wait()
       character.Humanoid.Died:Connect(function()
              character:Destroy()
       end
end)
1 Like

Use this code:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		char.Humanoid.Died:Connect(function()
			char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
		end)
	end)
end)