I have made a Ragdoll script, which creates attachments and "Ball in socket" constrains between the character's limbs and torso. When the character dies, all of its Welds breaks except the constrains, turning it into a ragdoll

The problem is that It only works in studio mode. When I tested It online, the character limbs breaks appart just like a normal death. Do anyone know how to fix this?

Also, I tried using that GUI which displays script errors in-game, and nothing pops out

In any case, heres the part of my script


function joint(part1,part2,pos1,pos2,stable)
	local attach0 = Instance.new("Attachment",part1)
	attach0.Position = pos1
	local attach1 = Instance.new("Attachment",part2)
	attach1.Position = pos2
	local socket = Instance.new("BallSocketConstraint",part1)
	socket.Attachment0 = attach0
	socket.Attachment1 = attach1
	
	if stable then
		socket.LimitsEnabled = true
		socket.UpperAngle = 0
		socket.TwistLimitsEnabled = true
		socket.TwistLowerAngle = 0
		socket.TwistUpperAngle = 0
	end
	
	local tab = {socket,attach0,attach1}
	return tab
end

local attachments = {
	joint(torso,rArm,Vector3.new(1.5,0.5,0),Vector3.new(0,0.5,0),false),
	joint(torso,lArm,Vector3.new(-1.5,0.5,0),Vector3.new(0,0.5,0),false),
	joint(torso,rLeg,Vector3.new(0.5,-1,0),Vector3.new(0,1,0),false),
	joint(torso,lLeg,Vector3.new(-0.5,-1,0),Vector3.new(0,1,0),false),
	joint(torso,fHead,Vector3.new(0,1,0),Vector3.new(0,-0.5,0),false)
}

2 comments

0

script pls

0

here, I edited my post