Tool works fine for one person but not another

So basically i have a tool that welds a player to another on activation,and it works fine for only 1 out of the 2 players.For the first player it works fine and the Target is welded to the players HumanoidRootPart. But for the 2nd player,the player is teleported under the player who is the target.Any solution?


GrabbedPerson = nil
HoldingPlayer
local debris = game:GetService("Debris")
tool.Activated:Connect(function()
	local Enabled = script.Parent.Parent.Enabled.Value

	local Damage = script.Parent.Parent.Damage.Value

 

	local Cooldown = script.Parent.Parent.Cooldown.Value

	local Hitbox = game.ReplicatedStorage.HitboxesAndParts.DefaultHitbox
	
	local Player = script.Parent.Parent
	
	local weld = Instance.new("ManualWeld")
	local ClonedHitbox = Hitbox:Clone()
	ClonedHitbox.Parent = game.Workspace
	ClonedHitbox.Position = Player.HumanoidRootPart.Position
	weld.Parent = ClonedHitbox
	weld.Part0 = Player.HumanoidRootPart
	weld.Part1 = ClonedHitbox
	weld.C0 =  CFrame.new(0,0,-3)
	debris:AddItem(ClonedHitbox,1)
	print("hitboxed")
	ClonedHitbox.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("IsGrabbable").Value ~= Player.IsGrabbable.Value then
			local GrabAniamtion = script.GrabbedAnimation
			local GrabAnimationTrack = Player.Humanoid:LoadAnimation(GrabAniamtion)
			GrabAnimationTrack:Play()
			GrabbedPerson = hit.Parent
			ClonedHitbox.CanTouch = false
			local weld = Instance.new("ManualWeld")
			weld.Parent = GrabbedPerson
			weld.Part0 = Player.HumanoidRootPart
			weld.Part1 = GrabbedPerson.HumanoidRootPart
			GrabbedPerson.HumanoidRootPart.Position = Player.HumanoidRootPart.Position
			weld.C0 =  CFrame.new(0,3,0)
			
			for _, v in pairs(GrabbedPerson:GetDescendants()) do  --ragdoll
				if v:IsA("Motor6D") then
					local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
					a0.CFrame = v.C0
					a1.CFrame = v.C1
					a0.Parent = v.Part0
					a1.Parent = v.Part1
					local b = Instance.new("BallSocketConstraint")
					b.Attachment0 = a0
					b.Attachment1 = a1
					b.Parent = v.Part0
					v.Enabled = false
				end
			end

			for i, v in pairs(GrabbedPerson:GetDescendants()) do
				if (v:IsA("BasePart")) then
					if v.Name == "Torso" then
						
					end
					v.CanCollide = false
				end
			end
			wait(5)
			for i, v in pairs(GrabbedPerson:GetDescendants()) do
				if (v:IsA("BasePart")) then
					if v.Name == "Torso" then

					end
					v.CanCollide = true
				end
			end
			weld:Destroy()
			for _,v in pairs(GrabbedPerson:GetDescendants()) do  --unragdoll
				if v:IsA('Motor6D') then
					v.Enabled = true
				end
				if v.Name == 'BallSocketConstraint' then
					v:Destroy()
				end
				if v.Name == 'Attachment' then
					v:Destroy()
				end
			end
		end
	end)
	
end)
1 Like

You could try changing player 2’s cframe to x in front of player 1.

2 Likes

You should post the script you wrote so that people might be able to spot errors.

2 Likes

Could you send a script so we can get better insight of the true issue, please?

2 Likes

show us the script i think i can help you with this problem quick

2 Likes

Added script (sorry for late reply)