Why do I have a Flying Ragdoll

Why is my ragdoll flying?


heres my code

local ps = game:GetService("PhysicsService")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character.Humanoid.BreakJointsOnDeath = false
		character.Humanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
		character.Humanoid.NameDisplayDistance = 0
		character.Archivable = true
		character.Humanoid.Died:Connect(function()
			
			local character2 = character:Clone()
			
			character2.Parent = workspace.Ragdolls

			-- Create ragdoll
			for _, v in pairs(character2:GetDescendants()) do
				if v:IsA("Motor6D") then
					v.Parent.Anchored = true
					v.Parent.CanCollide = true
					local a0,a1 = Instance.new("Attachment"),Instance.new("Attachment")
					a0.CFrame = v.C0
					a1.CFrame = v.C1
					a0.Parent = v.Part0
					a1.Parent = v.Part1

					local b = Instance.new("BallSocketConstraint")
					b.Attachment0 = a0
					b.Attachment1 = a1
					b.Parent = v.Part0
					v.Parent.Anchored = false
					v:Destroy()
				elseif v:IsA("Part") or v.Name == "Handle" then
					ps:SetPartCollisionGroup(v, "Ragdolls")
					v.CanCollide = true
				elseif v:IsA("Script") or v:IsA("LocalScript") then
					v:Destroy()
				elseif v:IsA("Attachment") then
					v:Destroy()
				end
			end
			for _, item in pairs(character:GetChildren()) do
				if item:IsA("MeshPart") then
					item:Destroy()
				elseif item:IsA("Accessory") then
					item:Destroy()
				end
			end
		end)
	end)
end)
2 Likes

Maybe try enabling Humanoid.PlatformStand?

1 Like

I want it to ragdoll though… will that affect how it ragdolls?

No it shouldn’t, it just removes control from the player preventing you from being able to move around when in the ragdoll state, here is an excerpt from the roblox API on this property:

“PlatformStand describes whether the Humanoid is currently in the PlatformStanding HumanoidStateType. When true, the Humanoid is in a state where it is free-falling and cannot move. This state behaves similar to sitting, except that jumping does not free the humanoid from the state.”

1 Like

Eyyyyy it works. Thanks so much!

Quick question, how do I stop it form colliding with the ground and itself. I removed the part where I set it to can collide false and also the physics portion.