local function z(z,c)for c,I in next,c:GetChildren()do local u=I:FindFirstChild(z)if u then return u end end end local function c(c)local I=c.Head local u=c:WaitForChild("\072\117\109\097\110\111\105\100")local F=c["\076\101\102\116 \065\114\109"]local P=c["\076\101\102\116 \076\101\103"]local S=c["\082\105\103\104\116 \076\101\103"]local R=c["\082\105\103\104\116 \065\114\109"]local q=c.Torso u.PlatformStand=true local U=c:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if U~=nil then U:Destroy()end local b=Instance.new("\065\116\116\097\099\104\109\101\110\116")local C=Instance.new("\065\116\116\097\099\104\109\101\110\116")local Y=Instance.new("\065\116\116\097\099\104\109\101\110\116")local K=Instance.new("\065\116\116\097\099\104\109\101\110\116")local o=Instance.new("\065\116\116\097\099\104\109\101\110\116")local N=Instance.new("\065\116\116\097\099\104\109\101\110\116")local B=Instance.new("\065\116\116\097\099\104\109\101\110\116")local D=Instance.new("\065\116\116\097\099\104\109\101\110\116")local X=Instance.new("\065\116\116\097\099\104\109\101\110\116")local s=Instance.new("\065\116\116\097\099\104\109\101\110\116")local x=Instance.new("\065\116\116\097\099\104\109\101\110\116")local f=Instance.new("\065\116\116\097\099\104\109\101\110\116")local w=script.ImpactSound:Clone()w.Parent=I w.Disabled=false local e=script.ImpactSound:Clone()e.Parent=F e.Disabled=false local J=script.ImpactSound:Clone()J.Parent=R J.Disabled=false local function v()C.Name="\072\101\097\100\065"C.Parent=I C.Position=Vector3.new(0,-0.5,0)C.Rotation=Vector3.new(0,0,0)C.Axis=Vector3.new(1,0,0)C.SecondaryAxis=Vector3.new(0,1,0)Y.Name="\076\101\102\116\065\114\109\065"Y.Parent=F Y.Position=Vector3.new(.5,1,0)Y.Rotation=Vector3.new(0,0,0)Y.Axis=Vector3.new(1,0,0)Y.SecondaryAxis=Vector3.new(0,1,0)K.Name="\076\101\102\116\076\101\103\065"K.Parent=P K.Position=Vector3.new(0,1,0)K.Rotation=Vector3.new(0,0,0)K.Axis=Vector3.new(1,0,0)K.SecondaryAxis=Vector3.new(0,1,0)o.Name="\082\105\103\104\116\065\114\109\065"o.Parent=R o.Position=Vector3.new(-0.5,1,0)o.Rotation=Vector3.new(0,0,0)o.Axis=Vector3.new(1,0,0)o.SecondaryAxis=Vector3.new(0,1,0)N.Name="\082\105\103\104\116\076\101\103\065"N.Parent=S N.Position=Vector3.new(0,1,0)N.Rotation=Vector3.new(0,0,0)N.Axis=Vector3.new(1,0,0)N.SecondaryAxis=Vector3.new(0,1,0)b.Name="\114\111\111\116\065"b.Parent=U b.Position=Vector3.new(0,0,0)b.Rotation=Vector3.new(0,90,0)b.Axis=Vector3.new(0,0,-1)b.SecondaryAxis=Vector3.new(0,1,0)end local function n()B.Name="\084\111\114\115\111\065"B.Parent=q B.Position=Vector3.new(.5,-1,0)B.Rotation=Vector3.new(0,0,0)B.Axis=Vector3.new(1,0,0)B.SecondaryAxis=Vector3.new(0,1,0)D.Name="\084\111\114\115\111\065\049"D.Parent=q D.Position=Vector3.new(-0.5,-1,0)D.Rotation=Vector3.new(0,0,0)D.Axis=Vector3.new(1,0,0)D.SecondaryAxis=Vector3.new(0,1,0)X.Name="\084\111\114\115\111\065\050"X.Parent=q X.Position=Vector3.new(-1,1,0)X.Rotation=Vector3.new(0,0,0)X.Axis=Vector3.new(1,0,0)X.SecondaryAxis=Vector3.new(0,1,0)s.Name="\084\111\114\115\111\065\051"s.Parent=q s.Position=Vector3.new(1,1,0)s.Rotation=Vector3.new(0,0,0)s.Axis=Vector3.new(1,0,0)s.SecondaryAxis=Vector3.new(0,1,0)x.Name="\084\111\114\115\111\065\052"x.Parent=q x.Position=Vector3.new(0,1,0)x.Rotation=Vector3.new(0,0,0)x.Axis=Vector3.new(1,0,0)x.SecondaryAxis=Vector3.new(0,1,0)f.Name="\084\111\114\115\111\065\053"f.Parent=q f.Position=Vector3.new(0,0,0)f.Rotation=Vector3.new(0,90,0)f.Axis=Vector3.new(0,0,-1)f.SecondaryAxis=Vector3.new(0,1,0)end spawn(v)spawn(n)local d=Instance.new("\066\097\108\108\083\111\099\107\101\116\067\111\110\115\116\114\097\105\110\116")d.Parent=F d.Attachment0=Y d.Attachment1=X d.Enabled=true d.LimitsEnabled=true d.UpperAngle=90 local V=Instance.new("\066\097\108\108\083\111\099\107\101\116\067\111\110\115\116\114\097\105\110\116")V.Parent=R V.Attachment0=o V.Attachment1=s V.Enabled=true V.LimitsEnabled=false V.UpperAngle=90 local L=Instance.new("\066\097\108\108\083\111\099\107\101\116\067\111\110\115\116\114\097\105\110\116")L.Parent=I L.Attachment0=C L.Attachment1=x L.Enabled=true L.LimitsEnabled=true L.TwistLimitsEnabled=true L.UpperAngle=74 local y=Instance.new("\066\097\108\108\083\111\099\107\101\116\067\111\110\115\116\114\097\105\110\116")y.Parent=q y.Attachment0=D y.Attachment1=K y.Enabled=true y.LimitsEnabled=true y.UpperAngle=90 local r=Instance.new("\066\097\108\108\083\111\099\107\101\116\067\111\110\115\116\114\097\105\110\116")r.Parent=q r.Attachment0=B r.Attachment1=N r.Enabled=true r.LimitsEnabled=true r.UpperAngle=90 local O=Instance.new("\066\097\108\108\083\111\099\107\101\116\067\111\110\115\116\114\097\105\110\116")O.Parent=U O.Attachment0=b O.Attachment1=f O.Enabled=true O.LimitsEnabled=true O.UpperAngle=0 I.Velocity=I.CFrame.p*(CFrame.new(0,-1,-0.1)).p for I,u in next,c:GetChildren()do if u:IsA("\065\099\099\111\117\116\114\101\109\101\110\116")then for I,F in next,u:GetChildren()do if F:IsA("\066\097\115\101\080\097\114\116")then F.Parent=c u:remove()local I=F:FindFirstChildOfClass("\065\116\116\097\099\104\109\101\110\116")local P=z(I.Name,c)if P and I then local z=Instance.new("\072\105\110\103\101\067\111\110\115\116\114\097\105\110\116")z.Attachment0=P z.Attachment1=I z.LimitsEnabled=true z.UpperAngle=0 z.LowerAngle=0 z.Parent=c end end end end end end return c
-- RAGDOLL A R6 CHARACTER.

local function getAttachment0(attachmentName, char)
	for _, child in next, char:GetChildren() do
		local attachment = child:FindFirstChild(attachmentName)
		if attachment then
			return attachment
		end
	end
end

local function ragdollPlayer(char)
	local head = char["Head"]
	local hum = char:WaitForChild("Humanoid")
	local leftarm = char["Left Arm"]
	local leftleg = char["Left Leg"]
	local rightleg = char["Right Leg"]
	local rightarm = char["Right Arm"]
	local torso = char.Torso
	hum.PlatformStand = true
	local root = char:FindFirstChild("HumanoidRootPart")
	if root ~= nil then
		root:Destroy()
	end
	local rootA = Instance.new("Attachment")
	local HeadA = Instance.new("Attachment")
	local LeftArmA = Instance.new("Attachment")
	local LeftLegA = Instance.new("Attachment")
	local RightArmA = Instance.new("Attachment")
	local RightLegA = Instance.new("Attachment")
	local TorsoA = Instance.new("Attachment")
	local TorsoA1 = Instance.new("Attachment")
	local TorsoA2 = Instance.new("Attachment")
	local TorsoA3 = Instance.new("Attachment")
	local TorsoA4 = Instance.new("Attachment")
	local TorsoA5 = Instance.new("Attachment")

	local impactH = script.ImpactSound:Clone()
	impactH.Parent = head
	impactH.Disabled = false
	local impactLA = script.ImpactSound:Clone()
	impactLA.Parent = leftarm
	impactLA.Disabled = false
	local impactRA = script.ImpactSound:Clone()
	impactRA.Parent = rightarm
	impactRA.Disabled = false

	local function set1()
		HeadA.Name = "HeadA"
		HeadA.Parent = head
		HeadA.Position = Vector3.new(0, -0.5, 0)
		HeadA.Rotation = Vector3.new(0, 0, 0)
		HeadA.Axis = Vector3.new(1, 0, 0)
		HeadA.SecondaryAxis = Vector3.new(0, 1, 0)
		LeftArmA.Name = "LeftArmA"
		LeftArmA.Parent = leftarm
		LeftArmA.Position = Vector3.new(0.5, 1, 0)
		LeftArmA.Rotation = Vector3.new(0, 0, 0)
		LeftArmA.Axis = Vector3.new(1, 0, 0)
		LeftArmA.SecondaryAxis = Vector3.new(0, 1, 0)
		LeftLegA.Name = "LeftLegA"
		LeftLegA.Parent = leftleg
		LeftLegA.Position = Vector3.new(0, 1, 0)
		LeftLegA.Rotation = Vector3.new(0, 0, 0)
		LeftLegA.Axis = Vector3.new(1, 0, 0)
		LeftLegA.SecondaryAxis = Vector3.new(0, 1, 0)
		RightArmA.Name = "RightArmA"
		RightArmA.Parent = rightarm
		RightArmA.Position = Vector3.new(-0.5, 1, 0)
		RightArmA.Rotation = Vector3.new(0, 0, 0)
		RightArmA.Axis = Vector3.new(1, 0, 0)
		RightArmA.SecondaryAxis = Vector3.new(0, 1, 0)
		RightLegA.Name = "RightLegA"
		RightLegA.Parent = rightleg
		RightLegA.Position = Vector3.new(0, 1, 0)
		RightLegA.Rotation = Vector3.new(0, 0, 0)
		RightLegA.Axis = Vector3.new(1, 0, 0)
		RightLegA.SecondaryAxis = Vector3.new(0, 1, 0)
		rootA.Name = "rootA"
		rootA.Parent = root
		rootA.Position = Vector3.new(0, 0, 0)
		rootA.Rotation = Vector3.new(0, 90, 0)
		rootA.Axis = Vector3.new(0, 0, -1)
		rootA.SecondaryAxis = Vector3.new(0, 1, 0)
	end
	local function set2()
		TorsoA.Name = "TorsoA"
		TorsoA.Parent = torso
		TorsoA.Position = Vector3.new(0.5, -1, 0)
		TorsoA.Rotation = Vector3.new(0, 0, 0)
		TorsoA.Axis = Vector3.new(1, 0, 0)
		TorsoA.SecondaryAxis = Vector3.new(0, 1, 0)
		TorsoA1.Name = "TorsoA1"
		TorsoA1.Parent = torso
		TorsoA1.Position = Vector3.new(-0.5, -1, 0)
		TorsoA1.Rotation = Vector3.new(0, 0, 0)
		TorsoA1.Axis = Vector3.new(1, 0, 0)
		TorsoA1.SecondaryAxis = Vector3.new(0, 1, 0)
		TorsoA2.Name = "TorsoA2"
		TorsoA2.Parent = torso
		TorsoA2.Position = Vector3.new(-1, 1, 0)
		TorsoA2.Rotation = Vector3.new(0, 0, 0)
		TorsoA2.Axis = Vector3.new(1, 0, 0)
		TorsoA2.SecondaryAxis = Vector3.new(0, 1, 0)
		TorsoA3.Name = "TorsoA3"
		TorsoA3.Parent = torso
		TorsoA3.Position = Vector3.new(1, 1, 0)
		TorsoA3.Rotation = Vector3.new(0, 0, 0)
		TorsoA3.Axis = Vector3.new(1, 0, 0)
		TorsoA3.SecondaryAxis = Vector3.new(0, 1, 0)
		TorsoA4.Name = "TorsoA4"
		TorsoA4.Parent = torso
		TorsoA4.Position = Vector3.new(0, 1, 0)
		TorsoA4.Rotation = Vector3.new(0, 0, 0)
		TorsoA4.Axis = Vector3.new(1, 0, 0)
		TorsoA4.SecondaryAxis = Vector3.new(0, 1, 0)
		TorsoA5.Name = "TorsoA5"
		TorsoA5.Parent = torso
		TorsoA5.Position = Vector3.new(0, 0, 0)
		TorsoA5.Rotation = Vector3.new(0, 90, 0)
		TorsoA5.Axis = Vector3.new(0, 0, -1)
		TorsoA5.SecondaryAxis = Vector3.new(0, 1, 0)
	end
	spawn(set1)
	spawn(set2)
	--[[
	local HA = Instance.new("HingeConstraint")
	HA.Parent = head
	HA.Attachment0 = HeadA
	HA.Attachment1 = TorsoA4
	HA.Enabled = true
	HA.LimitsEnabled=true
	HA.LowerAngle=0
	HA.UpperAngle=0
	--]]
	local LAT = Instance.new("BallSocketConstraint")
	LAT.Parent = leftarm
	LAT.Attachment0 = LeftArmA
	LAT.Attachment1 = TorsoA2
	LAT.Enabled = true
	LAT.LimitsEnabled = true
	LAT.UpperAngle = 90
	local RAT = Instance.new("BallSocketConstraint")
	RAT.Parent = rightarm
	RAT.Attachment0 = RightArmA
	RAT.Attachment1 = TorsoA3
	RAT.Enabled = true
	RAT.LimitsEnabled = false
	RAT.UpperAngle = 90
	local HA = Instance.new("BallSocketConstraint")
	HA.Parent = head
	HA.Attachment0 = HeadA
	HA.Attachment1 = TorsoA4
	HA.Enabled = true
	HA.LimitsEnabled = true
	HA.TwistLimitsEnabled = true
	HA.UpperAngle = 74
	local TLL = Instance.new("BallSocketConstraint")
	TLL.Parent = torso
	TLL.Attachment0 = TorsoA1
	TLL.Attachment1 = LeftLegA
	TLL.Enabled = true
	TLL.LimitsEnabled = true
	TLL.UpperAngle = 90
	local TRL = Instance.new("BallSocketConstraint")
	TRL.Parent = torso
	TRL.Attachment0 = TorsoA
	TRL.Attachment1 = RightLegA
	TRL.Enabled = true
	TRL.LimitsEnabled = true
	TRL.UpperAngle = 90
	local RTA = Instance.new("BallSocketConstraint")
	RTA.Parent = root
	RTA.Attachment0 = rootA
	RTA.Attachment1 = TorsoA5
	RTA.Enabled = true
	RTA.LimitsEnabled = true
	RTA.UpperAngle = 0
	head.Velocity = head.CFrame.p * CFrame.new(0, -1, -0.1).p
	for _, child in next, char:GetChildren() do
		if child:IsA("Accoutrement") then
			for _, part in next, child:GetChildren() do
				if part:IsA("BasePart") then
					part.Parent = char
					child:remove()
					local attachment1 = part:FindFirstChildOfClass("Attachment")
					local attachment0 = getAttachment0(attachment1.Name, char)
					if attachment0 and attachment1 then
						local constraint = Instance.new("HingeConstraint")
						constraint.Attachment0 = attachment0
						constraint.Attachment1 = attachment1
						constraint.LimitsEnabled = true
						constraint.UpperAngle = 0
						constraint.LowerAngle = 0
						constraint.Parent = char
					end
				end
			end
		end
	end
end

return ragdollPlayer
