Make Player Keep Trail When Die

Hi i currently have a script which gives player their trail when they click equip.

But when they die they have to re equip it?

Is their any way to resolve this?

local MarketPlaceService = game:GetService("MarketplaceService")

local player = game:GetService("Players").LocalPlayer

local RainbowpassID = 86294878

local ItemFrame = script.Parent.Frame.ScrollingFrame

local Trail = game.ReplicatedStorage["RainbowTrail"] -- Don't Put Serverstorage as client can't access serverstorage




wait(player.Character:WaitForChild("HumanoidRootPart"))
local success, hasPass = pcall(function() -- Changing the pcall to the correct format
	return MarketPlaceService:UserOwnsGamePassAsync(player.UserId, RainbowpassID)
end)

if success then -- Checking if successful
	if hasPass then -- Checking if the player has the
		
				
			local clone = script.Parent.Frame.ScrollingFrame.sample:Clone()

		clone.ImageLabel.Image = "http://www.roblox.com/asset/?id="..10939695942
			clone.Parent = script.Parent.Frame.ScrollingFrame

			clone.Visible = true
	clone.Equipped.Visible = false
					
			
		local equip = clone.Equip

		
			local clicks = 0
			
			
		
		equip.MouseButton1Click:Connect(function(equipped)
			
			clone.Equipped.Visible = true
			 clicks += 1
			
			
			local character = player.Character
			
			task.wait()
			local Head = character:FindFirstChild('Head') -- will wait until the head is loaded, at that time the code below will be yielded by this function, using waitforchild on something that doesnt exist will yield infinitely
			local Torso = character:FindFirstChild('Torso')
			local LowerTorso = character:FindFirstChild('LowerTorso') -- both has waistbackattachment
			local plrTrail = Trail:Clone()
			if Torso then
				plrTrail.Parent = Torso
				plrTrail.Attachment1 = Torso.WaistBackAttachment
			elseif LowerTorso then
				plrTrail.Parent = LowerTorso
				plrTrail.Attachment1 = LowerTorso.WaistBackAttachment
			
				plrTrail.Attachment0 = Head.FaceFrontAttachment
				
				print("Hello1")
								
			end
						
				
			
clone.Equipped.MouseButton1Click:Connect(function(unequip)
					clicks = 0
					plrTrail:Destroy()
				

					clone.Equipped.Visible = false


		
				end)		
				
			end)
	end
end

Check when they die using Humanoid.Died and see if they had a trail equipped as they died, if they did put it back on when CharacterAdded is called.

how would i get the Humanoid as it doesnt recognise it

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

This has to be a local script by the way.