Unwelding causes player to teleport back

  1. If I press G, a player will weld to me, and if I press G again they’ll unweld.

  2. Once unwelded, player will teleport back to an old position.

  3. Nothing

If G was pressed and player is not welded

			local Players = game:GetService("Players")
			local character = player.Character

			local partA = target.HumanoidRootPart
			partA.Name = "PlayerHumanoid"
			local partB = character.Torso
			partA.Position = Vector3.new(0, 10, 0)
			partB.Position = Vector3.new(0, 10, 3)
			partA.Parent = character
				local weld = Instance.new("Weld")
				weld.Name = "Weld1"
			weld.Parent = character.Torso
			weld.Part0 = partA
			weld.Part1 = partB
			weld.C1 = CFrame.new(2, 0, -2)	
			target.Humanoid.PlatformStand = true
			target.Humanoid.HumanoidRootPart.CanCollide = false
				target.Torso.CanCollide = false

If player was welded and G was pressed

			elseif gactivated == true then
				gactivated = false

				target.gValue.Value = false
				local Players = game:GetService("Players")
				local character = player.Character or player.CharacterAdded:wait()
				character.PlayerHumanoid.Parent = target
				target.PlayerHumanoid.Name = "HumanoidRootPart"
				target.HumanoidRootPart.CanCollide = true
				target.Humanoid.PlatformStand = false
				target.Torso.Anchored = false
				target.Torso.CanCollide = true

robloxapp-20220310-1934574.wmv (1.6 MB)

You can make them tp into the player’s HumanoidRootPart, or make a attachment so that when the player is dropped, they get tped to the attachment? I feel like it could be lag or something.

I am feeling like it is because when I press G, the remote event to fire this unwelding is fired multiple times and I have no idea why it is happening.

Could be because of network ownership , set the network ownership of the welded player’s primary part to the player that he is welded to.

1 Like