Welding two player characters together

Hello, so I’ve been working on a game focusing around a fusion mechanic between players, where they share the same body. The only way I could get this to work in my head was to weld their player characters together. Only one of the two players is meant to control the “fusion”.

So what is the issue?

When I weld the two characters they behave strangely. The player in control whenever they’re jumping, they can’t move at all. They also can’t move in certain places on the baseplate for some reason.

After reading through some posts I realized that the other player’s character wasn’t massless so I wrote the following code:

local descendants = player1character:GetDescendants()
	for index = 1, #descendants do
		local descendant = descendants[index]
		if descendant:IsA("Part") or descendant:IsA("MeshPart") or descendant:IsA("UnionOperation") then
				descendant.Massless = true
		end
	end

Even after that I keep getting the same issue.

This is the current way I weld the two characters:

local weld = Instance.new("Weld", player1character.HumanoidRootPart)
weld.Part0 = player2character.HumanoidRootPart
weld.Part1 = player1character.HumanoidRootPart

Thank you for taking your time to read this!

1 Like

When I was creating a detain script, I first created a “WeldConstraint” which I believe you should use instead of a normal Weld. And also to get the player that is attached to not move or jump, I put the property “Platform Stand” inside the humanoid to true. So basically, weld the player, put all parts on massless, and put the humanoid in PlatformStand. Make sure to undo what you did when you un weld the character too.

3 Likes

Forgot to mention that I disabled the collision between player characters.

Just tried with a WeldConstraint and they still behave the same way as before. Also thank you for the suggestion on how to make the attached player not move at all but I am already using a different method because platform stand can be turned off through local scripts which can lead to potential exploits.

You could instead of using that loop, try using a loop that uses ipairs, this script might also make a difference but not too sure on it. I’m not sure how much it’ll change but it’s worth a shot.


local player1character = -- path
local player2character = -- path

for index , obj in ipairs(player1character:GetDescendants()) do
     if obj:IsA("BasePart") or obj:IsA("MeshPart") or obj:IsA("UnionOperation") then
          obj.Massless = true
     end
end

local newWeld = Instance.new("WeldConstraint")
newWeld.Parent = player1character:FindFirstChild("HumanoidRootPart")
newWeld.Part0 = player1character:FindFirstChild("HumanoidRootPart")
newWeld.Part1 = player2character:FindFirstChild("HumanoidRootPart")

Still the same issue, but I’ll be using ipairs from now on. It seems much easier than my previous loops, thank you!

1 Like

Doesn’t have to do with mass. As you are welding two characters together, they are fighting for control over network ownership. Clients have physics replication authority over their characters and by welding two players together, this confliction starts because they’re trying to influence each other without proper control. One character in this fusion must give up their network ownership.

So I modified the loop and the problem still isn’t fixed. Is this how one character gives up their network ownership to another? If yes then is the problem is supposed to be something else?

for index , obj in ipairs(player1character:GetDescendants()) do
	    if obj:IsA("BasePart") or obj:IsA("MeshPart") or obj:IsA("UnionOperation") then
	     	obj.Massless = true
		obj:SetNetworkOwner(Player2)
	    end
	end

Couldn’t you just set both player’s camera CFrame to follow your desired Character model?

1 Like

I haven’t thought of that, thank you.

1 Like