Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to clone a part into a player after death?

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

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

2 comments

0

What did you change besides line 3?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.