Ragdoll is glitchy when alive

I have come across a problem in which when my character ragdolls, it doesnt drop to the floor but, instead you can you still walk which is weird. Anyone know how to fix?

Scripts

		local hum:Humanoid = char:FindFirstChild("Humanoid")
		for i,v:Motor6D in pairs(char:GetDescendants()) do
			if v:IsA("Motor6D") then
				local a0 = Instance.new("Attachment")
				a0.Name = v.Part0.Name
				a0.CFrame = v.C0
				a0.Parent = v.Part0
				local a1 = Instance.new("Attachment")
				a1.Name = v.Part1.Name
				a1.CFrame = v.C1
				a1.Parent = v.Part1
				local bsc = Instance.new("BallSocketConstraint")
				bsc.Name = v.Name
				bsc.Attachment0 = a0
				bsc.Attachment1 = a1
				bsc.Parent = v.Parent
				bsc.LimitsEnabled = true
				bsc.TwistLimitsEnabled = true
				v:Destroy()
			end
		end
	end
	local function unragdoll(char:Model)
		local hum:Humanoid = char:FindFirstChild("Humanoid")
		for i,v:BallSocketConstraint in pairs(char:GetDescendants()) do
			if v:IsA("BallSocketConstraint") then
				local motor6d = Instance.new("Motor6D",v.Parent)
				motor6d.Name = v.Name
				motor6d.Part0 = char:FindFirstChild(v.Attachment0.Name,true)
				motor6d.Part1 = char:FindFirstChild(v.Attachment1.Name,true)
				motor6d.C0 = v.Attachment0.CFrame
				motor6d.C1 = v.Attachment1.CFrame
				v.Attachment0:Destroy()
				v.Attachment1:Destroy()
				v:Destroy()
			end
		end
	end`

The Humanoid is keeping the Player upright. You can set Humanoid.PlatformStand to true to prevent that.