Drop a part when you die

Trying to make a script where if you die, a part spawns at your humanoidrootpart. Using the Added and Died functions (I know those aren’t the name of the functions)

Also the part is supposed to be cloned from a folder in Lighting
I tried a few times but it doesn’t spawn. If it does, it doesn’t spawn at the humanoid root part but at position 0,0,0

I mean it’s simple, you just need the PlayerAdded, CharacterAdded, & Humanoid.Died Events to detect when that specific Character dies

local Part = game.Lighting:WaitForChild("Part")

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local Humanoid = Character:WaitForChild("Humanoid")

        Humanoid.Died:Connect(function()
            local PartClone = Part:Clone()
            PartClone.Parent = workspace
            PartClone.Position = Character.HumanoidRootPart.Position
        end)
    end)
end)
5 Likes

oh… I made a script that looked like that. The only thing I did wrong was forgetting the .Parent in PartClone. Thanks!

Yeaaah

Just keep in mind that when you create a Clone, it’s parent will automatically be set to nil so you’ll need to change that first before changing its properties

1 Like