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?

01game.Players.PlayerAdded:Connect(function(player)
02    player.CharacterAdded:Connect(function(character)
03        local Children = character:GetChildren()
04        character:WaitForChild("Humanoid").Died:Connect(function()
05            wait(2)
06            local clone = game.ReplicatedStorage.Link
07            clone.Parent = character
08                wait(0.1)
09        end)
10    end)
11end)

1 answer

Log in to vote
1
Answered by 3 years ago

Here's your answer:

01game:GetService("Players").PlayerAdded:Connect(function(plr)
02    plr.CharacterAdded:Connect(function(chr)
03        chr:WaitForChild("Humanoid").Died:Connect(function()
04            local Part = nil -- Replace nil with part directory, e.g. game.Workspace.Part
05            local PartClone = Part:Clone()
06 
07            PartClone.Parent = chr
08        end)
09    end)
10end)

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