How would I be able to clone a welded part on a humanoid after they die?

So straight to the point.

I’ve made a part that floats on a humanoid’s head. Whenever a person dies the object dissapears, does anyone know how I could correctly clone the object if a person dies so the part is always there in the Workspace?

Heres my script:

local Part = game.Workspace.jeesh

Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
local head = hit.Parent.Head
Part.CFrame = head.CFrame * CFrame.new(0, 5, 0)
local weld = Instance.new(“Weld”)
weld.Part0 = head
weld.Part1 = Part
weld.C0 = head.CFrame:Inverse()
weld.C1 = Part.CFrame:Inverse()
weld.Parent = head
end
end)

1 Like

When you say

How would I be able to clone a welded part on a humanoid after they die?

Are you asking how you’d weld it back to the player after they respawn with a clone of the welded part?

I wish to know both welding it back and cloning the part in Workspace when they respawn

There are quite a few ways to go about it.

If you’re looking to weld a select items to a player after respawn, I might consider you toggling a Boolean variable that runs a function when it’s on true or false depending on your preferences.

Alternatively if you’re looking to let users customise their characters and have the same desired effect, it’s going to require you to store the data in a table, either through the use of strings or another preferred method, it mainly depends on if you’re wanting to give users the option to customise their characters.

However, if you’re just looking for players to spawn with it on their head by default, you need to add it into a CharacterAdded function. This will give users the part whenever they respawn.

1 Like