How can I properly utilize :SetNetworkOwner() with welded parts?

This is very tricky, so listen carefully.
I have made a system where if you get super low on health, you get knocked down and ragdolled.
People can then pick you up and carry you around, as well as throw you anywhere they want.
The thing is, when you pick someone up, his UpperTorso gets welded to your UpperTorso and it somehow messes with the network ownership in a bad way. You will either get network ownership of both your character and the character you’re carrying, or the character you are carrying will get network ownership of your character (same goes for the server). This makes it so unpleasant to watch yourself getting carried, you and your camera are going to do the snappy-wobble (???) and the character that carries you is going to twitch and tilt rapidly, as well as losing his animations, making it really bad. So, I wanted to give the ownership of the ragdoll to the server so everybody gets a nice sight of what is happening, but I could not do that because of the weld.
Example:

image

image

image

Carrier’s view:

Ragdoll’s view:

Is there any way to fix this? If so, I am all ears.

On the DevHub it says only Anchored parts cannot be set.

Well yes, but this is a totally different case.

You can call SetNetworkOwner() on all BaseParts in the parent model, I believe.

local Character = workspace.Player

for _,d in pairs(Character:GetDescendants()) do
    if d:IsA('BasePart') then
       d:SetNetworkOwner(game.Players.NewOwner)
    end
end

Obviously, don’t use the preset variables.

To undo, do:

local Character = workspace.Player

for _,d in pairs(Character:GetDescendants()) do
    if d:IsA('BasePart') then
       d:SetNetworkOwner(nil)
    end
end

Oh and a biggie, this can ONLY BE CALLED BY THE SERVER.

This is what I did from the very beginning, in fact.

					if v:IsA("BasePart") then
						game.PhysicsService:SetPartCollisionGroup(v,"Ragdoll")
					end
				end
				for _,v in pairs(targ.Parent:GetDescendants()) do
					if v:IsA("BasePart") and v.Name ~= "UpperTorso" then
						v:SetNetworkOwner(nil)
					end
				end
				for _,v in pairs(plr.Character:GetDescendants()) do
					if v:IsA("BasePart") then
						game.PhysicsService:SetPartCollisionGroup(v,"Carrier")
						v:SetNetworkOwner(plr)
					end
				end

Though, I am afraid that it is not that easy.

The undo part is wrong since that sets them all to server. you should use SetNetworkOwnershipAuto()

If I do that, it will set both players’s ownership to server. That means that there will be severe input lag for the carrier, meaning that it is not an option. Remember that the characters are welded.

I was talking about that in the undo part he set them all to server, so thats not actually undo-ing the network ownership

i’m talking about @bt5191 answer

But I did not set all of their ownerships to the server. Am I missing your thought?

@LukaDev_0 Ah, I see, I see.

@Weldify Hmm, I see. Would you consider the issue related to how your ragdoll works or something else?

No, the issue is not related to the ragdoll.

I’ve been looking through my older code and found that SetNetworkOwner(nil) worked exactly the same as SetNetworkOwnershipAuto(). This is not to say that your way is more ideal, just that my way wasn’t necessarily “incorrect”.

@Weldify Might I suggest in addition to setting network ownership to the other player that you also weld the players together? It might work.

I will try using SetNetworkOwnershipAuto(), and by the way, the characters are already welded.

It does not acutally. SetNetworkOwner(nil) sets it so server and SetNetworkOwershipAuto() sets it to automatic (Nearest player or server, Default)

1 Like

I just realised when I reread the description. Maybe try setting the ragdolled player’s character’s network ownership to the server, so that when it is picked up by someone else, it won’t have conflicting network ownership?

The network ownership of a character is set to the player of the character. So conflitcting does not exist

The answer depends on who you want to see the character being picked up first.

Spoiler alert: :SetNetworkOwnershipAuto() did not work.
It gave the ownership to the ragdoll, and this is what happened:

I’m not sure why you replied to me about that…

I’ve noticed that it looks like one player is colliding with another. Are you positive the collision groups are working correctly?

If the collision groups were not working correctly then this guy’s fate was not going to be so cruel:

2 Likes

On another note, I think that a weld links the characters together. Is there any way to keep two parts attached with similar properties to a weld (not motor6D, since it clearly links the parts together)?
What do you think about it? @bt5191