Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to clone a part into a player after death?

Asked by 3 years ago

I just want to clone a part into the player after they die, the problem is, the part disappears when the player respawns, any help?


game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local Children = character:GetChildren() character:WaitForChild("Humanoid").Died:Connect(function() wait(2) local clone = game.ReplicatedStorage.Link clone.Parent = character wait(0.1) end) end) end)

1 answer

Log in to vote
1
Answered by 3 years ago

Here's your answer:

game:GetService("Players").PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(chr)
        chr:WaitForChild("Humanoid").Died:Connect(function()
            local Part = nil -- Replace nil with part directory, e.g. game.Workspace.Part
            local PartClone = Part:Clone()

            PartClone.Parent = chr
        end)
    end)
end)

Remember to always search Roblox Dev first, https://developer.roblox.com/en-us/api-reference/event/Humanoid/Died

0
What did you change besides line 3? SilverishReign 75 — 3y
0
LMAO he removed the wait and renamed "clone" lOl, the characters descendants are cleared shortly after dying so whatever ur trying to accomplish would be better in workspace, probably greatneil80 2647 — 3y
Ad

Answer this question