function makespring(paren, co, ci, parto, parti, name)
	local spring = Instance.new("SpringConstraint")
	spring.Name = name
	local atch = Instance.new("Attachment")
	local atch2 = Instance.new("Attachment")
	spring.LimitsEnabled = true
	spring.MaxLength = 1.4
	spring.Stiffness = 500
	spring.Attachment0 = atch
	spring.Attachment1 = atch2
	atch.Parent = parto
	atch2.Parent = parti
	spring.Parent = paren
end

function makelimb(parent, limb, cframe)
	local pr = Instance.new("Part")
	pr.Name = "limb"
	pr.Size = Vector3.new(1 * nscale, 1 * nscale, 1 * nscale)
	pr.Transparency = 1
	pr.Massless = true
	pr.CustomPhysicalProperties = PhysicalProperties.new(0.55, 0.3, 3,1,6)
	pr.CanCollide = true
	pr.Anchored = false
	pr.Parent = parent
	local w = Instance.new("Weld")
	w.Part0 = pr
	w.Part1 = limb
	w.C0 = cframe
	w.Parent = pr
end

function makejoint(paren, co, ci, parto, parti, name)
	local joint = Instance.new("Motor6D")
	joint.Name = name
	joint.C0 = co
	joint.C1 = ci
	joint.Part0 = parto
	joint.Part1 = parti
	joint.Parent = paren
end

local function ragdoll(chr)
	local human = chr["Humanoid"]
	local tors = chr.Torso
	local rarm = chr["Right Arm"]
	local larm = chr["Left Arm"]
	local rleg = chr["Right Leg"]
	local lleg = chr["Left Leg"]
	local hrp = chr.HumanoidRootPart
	local hed = chr.Head

	human.PlatformStand = true
	human.AutoRotate = false
	human:UnequipTools()

	local RightShoulderC0 = CFrame.new(1.5 * nscale, 0.5 * nscale, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local RightShoulderC1 = CFrame.new(0, 0.5 * nscale, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local LeftShoulderC0 = CFrame.new(-1.5 * nscale, 0.5 * nscale, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local LeftShoulderC1 = CFrame.new(0, 0.5 * nscale, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local RightHipC0 = CFrame.new(0.5 * nscale, -1 * nscale, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local RightHipC1 = CFrame.new(0, 1 * nscale, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local LeftHipC0 = CFrame.new(-0.5 * nscale, -1 * nscale, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local LeftHipC1 = CFrame.new(0 * nscale, 1 * nscale, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local RootJointC0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
	local RootJointC1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
	local NeckC0 = CFrame.new(0, 1 * nscale, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
	local NeckC1 = CFrame.new(0, -0.5 * nscale, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)

	if rarm and tors:FindFirstChild("Right Shoulder") then
		tors:FindFirstChild("Right Shoulder"):Destroy()
		makespring(tors, RightShoulderC0, RightShoulderC1, tors, rarm, "Right Shoulder")
		makelimb(rarm, rarm, CFrame.new(0, 0.5, 0))
	end
	if larm and tors:FindFirstChild("Left Shoulder") then
		tors:FindFirstChild("Left Shoulder"):Destroy()
		makespring(tors, LeftShoulderC0, LeftShoulderC1, tors, larm, "Left Shoulder")
		makelimb(larm, larm, CFrame.new(0, 0.5, 0))
	end
	if rleg and tors:FindFirstChild("Right Hip") then
		tors:FindFirstChild("Right Hip"):Destroy()
		makespring(tors, RightHipC0, RightHipC1, tors, rleg, "Right Hip")
		makelimb(rleg, rleg, CFrame.new(0, 0.5, 0))
	end
	if lleg and tors:FindFirstChild("Left Hip") then
		tors:FindFirstChild("Left Hip"):Destroy()
		makespring(tors, LeftHipC0, LeftHipC1, tors, lleg, "Left Hip")
		makelimb(lleg, lleg, CFrame.new(0, 0.5, 0))
	end
end

local function getup(chr)
	local human = chr["Humanoid"]
	local tors = chr.Torso
	local rarm = chr["Right Arm"]
	local larm = chr["Left Arm"]
	local rleg = chr["Right Leg"]
	local lleg = chr["Left Leg"]
	local hrp = chr.HumanoidRootPart
	local hed = chr.Head

	local RSC0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local RSC1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local LSC0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local LSC1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local RHC0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local RHC1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
	local LHC0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local RJC1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
	local LHC1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	local NC0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
	local NC1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
	local RJC0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)

	human.PlatformStand = false
	human.AutoRotate = true

	if rarm and tors:FindFirstChild("Right Shoulder") then
		tors:FindFirstChild("Right Shoulder"):Destroy()
		makejoint(tors, RSC0, RSC1, tors, rarm, "Right Shoulder")
		rarm:FindFirstChild("touchy"):Destroy()
	end
	if larm and tors:FindFirstChild("Left Shoulder") then
		tors:FindFirstChild("Left Shoulder"):Destroy()
		makejoint(tors, LSC0, LSC1, tors, larm, "Left Shoulder")
		larm:FindFirstChild("touchy"):Destroy()
	end
	if rleg and tors:FindFirstChild("Right Hip") then
		tors:FindFirstChild("Right Hip"):Destroy()
		makejoint(tors, RHC0, RHC1, tors, rleg, "Right Hip")
		rleg:FindFirstChild("touchy"):Destroy()
	end
	if lleg and tors:FindFirstChild("Left Hip") then
		tors:FindFirstChild("Left Hip"):Destroy()
		makejoint(tors, LHC0, LHC1, tors, lleg, "Left Hip")
		lleg:FindFirstChild("touchy"):Destroy()
	end
	local RS = tors:FindFirstChild("Right Shoulder")
	local LS = tors:FindFirstChild("Left Shoulder")
	local RH = tors:FindFirstChild("Right Hip")
	local LH = tors:FindFirstChild("Left Hip")
	local RJ = hrp:FindFirstChild("RootJoint")
	local N = tors:FindFirstChild("Neck")
end

Misc.Ragdoll = function(Target, Duration)
	if Target:FindFirstChild("Ragdoll") then
		Target.Ragdoll.Value = true
		Misc.InsertDisabled(Target, Duration)
		ragdoll(Target)
		coroutine.resume(coroutine.create(function()
			wait(Duration)
			getup(Target)
			if Target:FindFirstChild("Ragdoll") then
				Target.Ragdoll.Value = false
			end
		end))
	end
end

sorry for the giant code block, but I want you guys to see everything so that you can help actually solve the issue, it works fine if the player that called this function doesn't die but otherwise the other player gets stuck ragdolled. This is in a module.

1 comment

0

I think the getup function just never gets called but idk why please help. I have pinpointed the issue but i dont know why