Carry system instantly kills player B that carry player A

Making carry system.

For example, Player A (Died) and Player B (Alive)
Player B pick up Player A and instantly DIES.
I dont know what really happens, outpit - Clear.

For first i thought it is because of collision group change. but no (I changed it to just Can Collide = false, even deleted this part of code, nothing changed).

What do i do?

local HeyCarrying
local amCarrying
local function ateba(plr)
	for _,v in pairs(plr.Character:GetChildren()) do
		if v:IsA("BasePart") then
			v.Massless = true

		end
	end
	wait(3)
	for _,v in pairs(plr.Character:GetChildren()) do
		if v:IsA("BasePart") then
			v.CollisionGroup="tool"

		end
	end
end
game.Players.PlayerAdded:Connect(function(plr)
	wait(10)
	local humanoid = plr.Character:WaitForChild("Humanoid")
	local char =plr.Character
	humanoid.BreakJointsOnDeath = false
	for i, part in plr.Character:GetChildren() do
		if part:IsA("BasePart") then
			part.CollisionGroup = "player"
		end
	end

	humanoid.Died:Connect(function()
		local hight = script.Highlight:Clone()

		hight.Parent = char
		hight.Adornee = char

		local as = Instance.new('ProximityPrompt', char.Torso)

		as.Triggered:Connect(function(plr2)



			if plr2 ~= plr then
				as.Enabled=false

				--[[plr2.Character.Humanoid:LoadAnimation(script.Animation):Play()
				plr2.Character.HumanoidRootPart.CFrame = plr.Character["Left Arm"].CFrame
				wait(1)
				local rope = Instance.new("RopeConstraint", plr.Character.Head)
				rope.Attachment0 = plr.Character["Left Arm"].LeftGripAttachment
				rope.Attachment1 = plr2.Character["Left Arm"].LeftGripAttachment
				rope.Length = 7
				rope.Visible = true
				plr2.Character.Humanoid.JumpHeight = 9
				plr2.Character.Humanoid.WalkSpeed = 8
				for i, part in plr.Character:GetChildren() do
					if part:IsA("BasePart") then
						part.CollisionGroup = "tool"
					end
				end]]

				local ro, rc=plr2.Character.HumanoidRootPart,plr.Character.HumanoidRootPart
				plr.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
				plr.Character.Humanoid.PlatformStand = true
				
				local anim2 = plr2.Character.Humanoid:LoadAnimation(script.Carry)
				anim2:Play()
				HeyCarrying = anim2
				plr2.Character.Humanoid.JumpPower = 0
				plr2.Character.Humanoid.WalkSpeed = 13
				
				local w=Instance.new("Motor6D")
				w.Name = "carryweld"
				w.Part0 = ro
				w.Part1 = rc
				w.C1 = CFrame.new(0, -0.5, -1)
				w.C0 = CFrame.new()
				w.Parent = rc
				
				
				ateba(plr)
				
				
				plr.Character.Torso.Touched:Connect(function(hit)
					if hit.Name == "Live" then
						HeyCarrying:Stop()
						anim2:Destroy()
						w:Destroy()
						plr:LoadCharacter()
						plr.Character.Humanoid.Health = 1
						plr.Character.Humanoid.MaxHealth = 1
						plr.Character.Humanoid.WalkSpeed = 0
						plr.Character.Humanoid.JumpPower = 0
						plr2.Character.Humanoid.JumpPower = 90
						plr2.Character.Humanoid.WalkSpeed = 16
					
						local humanoid =plr.Character.Humanoid

						if humanoid then
							coroutine.wrap(function()
								while humanoid.Health < 55 do
									humanoid.MaxHealth = math.min(humanoid.MaxHealth + 1, 55)
									humanoid.Health = humanoid.MaxHealth
									wait(1)
								end
							
							end)()
						end

					end
				end)
			end
		end)
		for index,joint in pairs(plr.Character:GetDescendants()) do
			if joint:IsA("Motor6D") then

				local socket = Instance.new("BallSocketConstraint")
				local a1 = Instance.new("Attachment")
				local a2 = Instance.new("Attachment")
				a1.Parent = joint.Part0
				a2.Parent = joint.Part1
				socket.Parent = joint.Parent
				socket.Attachment0 = a1
				socket.Attachment1 = a2
				a1.CFrame = joint.C0
				a2.CFrame = joint.C1
				socket.LimitsEnabled = true
				socket.TwistLimitsEnabled = true
				joint:Destroy()
			end
		end
	end)
end)

1 Like

You’re destroying too many joints with joint:Destroy(). You cannot destroy joints like that, specifically the neck. Just disable them.

still kills player B when it tries to pick up dead player. Didnt fix the whole problem.

Can we see the actual carry code? This is just setup code.

I sent everything. There is only setup code to be honest. I just started making this system. I dont really see matter of using modules in such a small system.

i actually fixed that by using welds. not motor6D when player B pick up player A. But still do not know the root of this problem. So still im trying to seek for another solve. Or is there another solve?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.