Roblox Forum banner

Having trouble welding a part to the player when they respawn

617 Views 1 Reply 2 Participants Last post by  testaccounthaheya
Hello, as the title says I am having trouble welding a part to the player when they respawn. Here is what I want to do.
Using a part select gui, a part is welded to the player and parented into them when selected (which is not important).
but...When the player dies, everything in them is cleared... So I wanted to parent the part into the workspace when the player dies, and then parent it back into the player and also weld it to the player when they respawn, my issue is that the part just stays frozen in the workspace when it should be welded to the player's respawned body. Any help?

Code:
local Char = script.Parent
local Hum = Char.Humanoid
Char.Humanoid.BreakJointsOnDeath = false
Char.Humanoid.RequiresNeck = false
Char.Archivable = true

Hum.Died:Connect(function(player)
    local CharClone = Char:WaitForChild("Part"):Clone()
    CharClone.Parent = workspace
    CharClone.Anchored = true
wait(4)
    CharClone.Parent = player.Character or player.CharacterAdded:Wait()
    CharClone.CFrame = CFrame.new(player.Character.Torso.Position)
    CharClone.Anchored = false

    local Y = Instance.new("Weld")
    Y.Part0 = player.Character.Torso
    Y.Part1 = CharClone
    Y.Parent = Y.Part0
end)
1 - 2 of 2 Posts
try using a CharacterAdded function, then give it a wait() so roblox can detect it fully
1 - 2 of 2 Posts
Top