Welding two characters together without causing a bunch of glitches

Hey!

I’m trying to make a way for a player to detain another character, letting them walk around practically carrying them. I decided to use ManualWelds to do this, though the problem is that it seems to be extremely inconsistent. Sometimes it’ll work perfectly, though most times it’ll mess up completely with me being under the map, or with the other player having ownership over me. (somehow???)

My code:

Target.Character.Humanoid.PlatformStand = true

for _,v in pairs(Target.Character:GetDescendants()) do
    if v:IsA("BasePart") then
        v:SetNetworkOwner(plr)
    end
end

local Weld = Instance.new("ManualWeld")
Weld.Name = "DetainWeld"
Weld.Parent = plr.Character.HumanoidRootPart
Weld.Part0, Weld.Part1 = Weld.Parent, Target.Character.PrimaryPart
Weld.C0 = Weld.Parent.CFrame:inverse()
Weld.C1 = CFrame.new((Weld.Parent.Position + Weld.Parent.CFrame.LookVector * 3), Weld.Parent.Position + Weld.Parent.CFrame.LookVector):inverse()

If anybody knows how to fix this, it would be greatly appreciated. :slight_smile:

3 Likes

It looks like this same issue was addressed already in another post. If this does not solve your issue, then I am wondering if it is even possible to consistently override the player’s ownership of their own character. Player’s characters by default are owned by their player’s client.

Funny enough, I actually answered something similar a while ago.

In order to do what you want, you need to freeze the player (voiding it of all actions). How to freeze a player? - #11 by etensai

After that’s done, assuming that the player is welded, you can weld the humanoid root part to the player’s left or right hand. I’d advise against using model:SetPrimaryPartCFrame() since it’s less than performant.

Hope this helps!

@sanjay2003 @Hazania

Sorry for not letting you guys know earlier, but I actually solved the issue by making the target character massless. I’m assuming this either took weight off my character and made it not bug out, or prevented it from being a RootPart, automatically resetting network ownership back to the client.

Thanks for the help! :slight_smile:

4 Likes