Need help with a script that clones a drag detector into players bodies after they die

So the script is supposed to clone a drag detector PlayerDrag from Server Storage and insert it into a player’s character torso after they die, but it only works once and doesn’t work again I don’t really know what the issue is or how to fix it, so please help if you’re able to and thanks

Here is the code:

game.Players.PlayerAdded:Connect(function(plyr)
	
	local char = plyr.Character or plyr.CharacterAdded:Wait()
	local hum = char:WaitForChild("Humanoid")
	local drag = game.ServerStorage.PlayerDrag

		hum.Died:Connect(function()
		local Part = drag:Clone()
		Part.Parent = char.Torso
		
	end)
end)

Apologies if you didn’t understand what I said

Does the player’s dead body stay there, or does it just disappear like normal?

I forgot to mention that it saves

Could I see the script for the preservation?

That’s probably because you don’t have a CharacterAdded event setup, so it only runs once.

local function onCharacterAdded(char)
    local hum = char:WaitForChild("Humanoid")
	local drag = game.ServerStorage.PlayerDrag

    hum.Died:Connect(function()
		local Part = drag:Clone()
		Part.Parent = char.Torso
	end)
end

game.Players.PlayerAdded:Connect(function(plyr)
	if plyr.Character then
	    onCharacterAdded(plyr.Character)
	end
	plyr.CharacterAdded:Connect(onCharacterAdded)
end)

Not really its like a ragdoll loader made out of few scripts, modules and body constraints

I’m not at my computer so I can’t test anything, but try removing the onCharacterAdded function and just keep the “died” function (I’m new to scripting so it might not work)

Thanks very much and sorry for the trouble, it works now