----Maxoso41----

local function CanCollide(char)
	for i,v in next, char:GetChildren() do
		if v:IsA("BasePart") then
			v.CanCollide = true
		end
		if v.Name == "HumanoidRootPart" then
			v.CanCollide = false
			game:GetService("RunService").Heartbeat:connect(function()
				if char:FindFirstChild("UpperTorso") then
					v.CFrame = char:FindFirstChild("UpperTorso").CFrame
				end
			end)
		end
	end
end

local function MakeConstraints(char)
	pcall(function()
		local LeftFoot = char:FindFirstChild("LeftFoot")
		local RightFoot = char:FindFirstChild("RightFoot")
		local LeftLowerLeg = char:FindFirstChild("LeftLowerLeg")
		local RightLowerLeg = char:FindFirstChild("RightLowerLeg")
		local LeftUpperLeg = char:FindFirstChild("LeftUpperLeg")
		local RightUpperLeg = char:FindFirstChild("RightUpperLeg")
		local LowerTorso = char:FindFirstChild("LowerTorso")
		local UpperTorso = char:FindFirstChild("UpperTorso")
		local LeftHand = char:FindFirstChild("LeftHand")
		local RightHand = char:FindFirstChild("RightHand")
		local LeftLowerArm = char:FindFirstChild("LeftLowerArm")
		local RightLowerArm = char:FindFirstChild("RightLowerArm")
		local LeftUpperArm = char:FindFirstChild("LeftUpperArm")
		local RightUpperArm = char:FindFirstChild("RightUpperArm")
		local Head = char:FindFirstChild("Head")
		
		local S1 = Instance.new("SpringConstraint",LeftFoot)
		S1.Damping = 0
		S1.FreeLength = 0.15
		S1.Stiffness = 1500
		S1.Attachment0 = LeftFoot:FindFirstChild("LeftAnkleRigAttachment")
		S1.Attachment1 = LeftLowerLeg:FindFirstChild("LeftAnkleRigAttachment")
		
		local S2 = Instance.new("SpringConstraint",RightFoot)
		S2.Damping = 0
		S2.FreeLength = 0.15
		S2.Stiffness = 1500
		S2.Attachment0 = RightFoot:FindFirstChild("RightAnkleRigAttachment")
		S2.Attachment1 = RightLowerLeg:FindFirstChild("RightAnkleRigAttachment")
		
		local H1 = Instance.new("HingeConstraint",LeftLowerLeg)
		H1.Attachment0 = LeftLowerLeg:FindFirstChild("LeftKneeRigAttachment")
		H1.Attachment1 = LeftUpperLeg:FindFirstChild("LeftKneeRigAttachment")
		
		local H2 = Instance.new("HingeConstraint",RightLowerLeg)
		H2.Attachment0 = RightLowerLeg:FindFirstChild("RightKneeRigAttachment")
		H2.Attachment1 = RightUpperLeg:FindFirstChild("RightKneeRigAttachment")
		
		local B1 = Instance.new("BallSocketConstraint",LeftUpperLeg)
		B1.Attachment0 = LeftUpperLeg:FindFirstChild("LeftHipRigAttachment")
		B1.Attachment1 = LowerTorso:FindFirstChild("LeftHipRigAttachment")
		
		local B2 = Instance.new("BallSocketConstraint",RightUpperLeg)
		B2.Attachment0 = RightUpperLeg:FindFirstChild("RightHipRigAttachment")
		B2.Attachment1 = LowerTorso:FindFirstChild("RightHipRigAttachment")
		
		local H3 = Instance.new("HingeConstraint",LowerTorso)
		H3.Attachment0 = LowerTorso:FindFirstChild("WaistRigAttachment")
		H3.Attachment1 = UpperTorso:FindFirstChild("WaistRigAttachment")
		
		local B3 = Instance.new("BallSocketConstraint",LeftUpperArm)
		B3.Attachment0 = LeftUpperArm:FindFirstChild("LeftShoulderRigAttachment")
		B3.Attachment1 = UpperTorso:FindFirstChild("LeftShoulderRigAttachment")
		
		local B4 = Instance.new("BallSocketConstraint",RightUpperArm)
		B4.Attachment0 = RightUpperArm:FindFirstChild("RightShoulderRigAttachment")
		B4.Attachment1 = UpperTorso:FindFirstChild("RightShoulderRigAttachment")
		
		local H3 = Instance.new("HingeConstraint",LeftLowerArm)
		H3.Attachment0 = LeftLowerArm:FindFirstChild("LeftElbowRigAttachment")
		H3.Attachment1 = LeftUpperArm:FindFirstChild("LeftElbowRigAttachment")
		
		local H4 = Instance.new("HingeConstraint",RightLowerArm)
		H4.Attachment0 = RightLowerArm:FindFirstChild("RightElbowRigAttachment")
		H4.Attachment1 = RightUpperArm:FindFirstChild("RightElbowRigAttachment")
		
		local S3 = Instance.new("SpringConstraint",LeftHand)
		S3.Damping = 0
		S3.FreeLength = 0.15
		S3.Stiffness = 1500
		S3.Attachment0 = LeftHand:FindFirstChild("LeftWristRigAttachment")
		S3.Attachment1 = LeftLowerArm:FindFirstChild("LeftWristRigAttachment")
		
		local S4 = Instance.new("SpringConstraint",RightHand)
		S4.Damping = 0
		S4.FreeLength = 0.15
		S4.Stiffness = 1500
		S4.Attachment0 = RightHand:FindFirstChild("RightWristRigAttachment")
		S4.Attachment1 = RightLowerArm:FindFirstChild("RightWristRigAttachment")
		
		local S5 = Instance.new("SpringConstraint",Head)
		S5.Damping = 10
		S5.FreeLength = 0.1
		S5.Stiffness = 1200
		S5.Attachment0 = Head:FindFirstChild("NeckRigAttachment")
		S5.Attachment1 = UpperTorso:FindFirstChild("NeckRigAttachment")
	end)
end

char = script.Parent
	script.Parent.Humanoid.Died:connect(function()
			CanCollide(char)
			MakeConstraints(char)
	end)

