Welding 2 players together

I’m making something that involves one player being welded onto another. one player is meant to be in a ragdoll-like state using platformstand and the other is not. In-studio, it works as expected, but in-game, there are times when the player with platformstand set to false moves weird and walks funny while the other player is welded to them. Is there a way around this?

3 Likes

Best way to handle this would be to make a copy of the player, rag doll the player, set the rag doll player’s camera to the new rag doll. Weld the rag doll to the new player, set the physics to the new player and then when you get to where you’re going and want to drop said player, you could do something like teleport the real player to the rag dolls location after it’s been detached. Delete the rag doll, and show the actual player’s character. Also don’t forget to update the camera.

I’m really sleepy though, so sorry for how crude this post is. Hope it helps.

3 Likes

Wow dude I never even considered that, Thank you!

2 Likes

Possibly removing part1 of motor6ds and storing their names in a table then inserting ballsocketconstraints that attach to an attachment0 and an attachment1, attachment0 would be motor6d’s part0 and attachment1 would be the player’s rigattachment. If you know how to make it work, you should be with a working ragdoll. If my idea doesn’t work or you need further explaining, reply to me.

That’s actually exactly what I did, but my question is how to avoid the “glitchiness” that occurs when u weld the ragdolled player to another player.

2 Likes

I have a kind of hacky solution, which makes your ragdoll (supposedly r15, i’m guessing) not fly into the air. It’ll help a lot. You’re gonna need two scripts. First you’ll need a global script inside of StarterCharacterScripts and put a LocalScript inside of that global script.
The global script:

local r = Instance.new("BoolValue",script)
local e = Instance.new("RemoteEvent",script)
local OnGround = false
local ragdolledMotor6ds = {}
function Ragdoll(parent)
	for _,v in pairs(parent:GetDescendants()) do
		if v:IsA("Motor6D") and ragdolledMotor6ds[v.Parent.Name] == nil then
			r.Value=true
			parent:FindFirstChildOfClass("Humanoid").PlatformStand=true
			ragdolledMotor6ds[v.Parent.Name] = v.Part1.Name
			v.Part1 = nil
			local socket = Instance.new("BallSocketConstraint",v.Parent)
			socket.Attachment0=v.Parent:FindFirstChild(v.Name.."RigAttachment")
			socket.Attachment1=v.Part0:FindFirstChild(v.Name.."RigAttachment")
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			socket.UpperAngle = 50
			socket.TwistLowerAngle = -90
			socket.TwistUpperAngle = 90
		end
	end
end
function StopRagdoll(parent)
	for _,v in pairs(parent:GetDescendants()) do
		if v:IsA("Motor6D") and not OnGround then
			r.Value=false
			parent:FindFirstChildOfClass("Humanoid").PlatformStand=false
			if ragdolledMotor6ds[v.Parent.Name] ~= nil then
				for _,a in pairs(parent:GetDescendants()) do
					if ragdolledMotor6ds[v.Parent.Name] == a.Name then
						v.Part1 = a
						break
					end
				end
				if v.Parent:FindFirstChildOfClass("BallSocketConstraint") then
					v.Parent:FindFirstChildOfClass("BallSocketConstraint"):Destroy()
				end
				ragdolledMotor6ds[v.Parent.Name] = nil
			end
		end
	end
end
local p = game.Players:GetPlayerFromCharacter(script.Parent)
e.OnServerEvent:Connect(function(P,BoolType)
	if P~=p or OnGround then return end
	r.Value=BoolType
end)
game:GetService("RunService").Heartbeat:Connect(function()
	if r.Value==true then
		script.Parent:WaitForChild("Humanoid").PlatformStand=true
		Ragdoll(script.Parent)
	else
		script.Parent:WaitForChild("Humanoid").PlatformStand=false
		StopRagdoll(script.Parent)
	end
end)

For the localscript:

local ragdeb = false
wait()
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(key)
	if string.lower(key) == "r" and not ragdeb then
		ragdeb = true
		if script.Parent:WaitForChild("Value").Value~=true then
			script.Parent:WaitForChild("RemoteEvent"):FireServer(true)
		else
			script.Parent:WaitForChild("RemoteEvent"):FireServer(false)
		end
		wait(1)
		ragdeb = false
	end
end)
while true do
	game:GetService("RunService").Heartbeat:Wait()
	print(script.Parent:WaitForChild("Value").Value)
	if script.Parent:WaitForChild("Value").Value==true then
		script.Parent.Parent:WaitForChild("Humanoid").PlatformStand=true
	else
		script.Parent.Parent:WaitForChild("Humanoid").PlatformStand=false
	end
end

Like I said, it’s kinda hacky in my opinion, but gets the job done. If you have problems with this just tell me.

1 Like

You can also avoid having to fly all over the place after stopping the platformstand with another script, reply if you need it.

Oh thank you! So far I haven’t had that flying issue, though. The issue is occurring when a player has a ragdolled player welded to them. They start walking funny and stuff.

Changing the player’s C0 or C1, depending on which C is the ragdoll’s, you’re gonna need to subtract it so it doesn’t bump into the player. I think this could be the problem.

You can also just make a RopeConstraint that attaches to a player’s rootpart and the ragdoll. It’s an easier solution than what I think you’re doing.