Hey, I'm back after a month or so. I have a ragdoll system (echoreaper's system) and I want to weld a player to another player. I did try to do this but I just can't get it right. I'm not sure if this is something with the ragdoll system or the network ownership.
function ChangeNetworkOwnership(char, networkOwner)
assert(char ~= nil, "A character must be passed!")
assert(networkOwner ~= nil, "Network owner must be passed!")
if typeof(networkOwner) == "string" then
if networkOwner == "Server" then
char.HumanoidRootPart:SetNetworkOwner(nil)
char.UpperTorso:SetNetworkOwner(nil)
end
else
char.HumanoidRootPart:SetNetworkOwner(networkOwner)
char.UpperTorso:SetNetworkOwner(networkOwner)
end
end
function ToggleWeld(carryChar, carryPlayer, toggled)
if toggled then
for _, v in pairs(carryPlayer.Character:GetChildren()) do
if v:IsA("BasePart") then
physics:SetPartCollisionGroup(v, "NonCollidable")
end
end
local folder = NewInstance {"Folder", carryChar, Name = "RagdollWeld"}
for _, v in pairs(carryChar:GetChildren()) do
if v:IsA("BasePart") then
v.Massless = true
physics:SetPartCollisionGroup(v, "NonCollidable")
v.Massless = true
v.CanCollide = false
NewInstance {
"Weld",
folder,
C0 = carryChar.HumanoidRootPart.CFrame:toObjectSpace(v.CFrame),
Part0 = carryChar.HumanoidRootPart,
Part1 = v,
Name = v.Name
}
end
end
return folder
else
if carryChar:FindFirstChild("RagdollWeld") then
for _, v in pairs(carryChar:GetChildren()) do
if v:IsA("BasePart") then
physics:SetPartCollisionGroup(v, "Players")
v.Massless = false
end
end
for _, v in pairs(carryPlayer.Character:GetChildren()) do
if v:IsA("BasePart") then
physics:SetPartCollisionGroup(v, "Players")
v.Massless = false
end
end
local ragdollWelds = carryChar:WaitForChild("RagdollWeld")
ragdollWelds:Destroy()
end
end
end
I am calling these functions with the correct arguments.
ChangeNetworkOwnership(CarryChar, player)

2 comments
Going into more detail, 30% of the time this works flawlessly, but the 70% mainly involves the character loop ragdolling or tilting over.
Update: Went a different route, but now it's giving ownership to the ragdoll. Same arguments passed.