Player welded to a part bug when getting killed

  1. What do you want to achieve? Hello, i found a bug with my elevator system that welds players to the lift to prevent any physics issues.

  2. What is the issue? When a player gets killed in it, the player that got killed dies and the player that killed the other dies too, and when they try going back in the elevator they are killed instantly.

This is how the system works, i have a table called PlayersInElevator each times a player character UpperTorso touch the detection part in the lift, the player is added to the table.

This is how i weld the players to the elevator

for i,v in pairs(PlayersInElevator) do
	local player = Players:FindFirstChild(v)
       if player then
			local character = player.Character
			if character.Humanoid.Health > 0 then
				if character:FindFirstChild("LowerTorso") then
					local WeldConstraint = Instance.new("WeldConstraint")
					WeldConstraint.Parent = LiftDetectPart
					WeldConstraint.Part0 = LiftDetectPart
					WeldConstraint.Part1 = character.LowerTorso
					character.Humanoid.Died:Once(function()
					WeldConstraint.Part1 = nil
					WeldConstraint.Enabled = false
					WeldConstraint:Destroy()
				end)
			end
		end
	end
end

And this is how i remove all the welds

for _, weld in pairs(LiftDetectPart:GetChildren()) do
	if weld:IsA("WeldConstraint") then
		weld.Part1 = nil
		weld.Enabled = false
		weld:Destroy()
	end
end
  1. What solutions have you tried so far? I looked on forums and tried to fix it myself.

I still need help for that issue

Bumping the topic because i still need help

Bumping the topic i still really need help

Quick question, are you by any chance tweening the elevator lift up and down and to prevent the player from shaking rapidly you weld them to the elevator?

Probably, and I am also looking for help here