Character cant jump and only move and stucks in fall animation after unragdoll

This is super annoying and I have no idea how to solve this problem



function setJoints(player : Player, jointType : string) 
	local character = player.Character
	local humanoid : Humanoid = character:FindFirstChild("Humanoid")
	humanoid.BreakJointsOnDeath = false
	humanoid.RequiresNeck = false
	local descendants = character:GetDescendants()
	for i, object in descendants do
		if object:IsA(jointType == "BallSocketConstraint" and "Motor6D" or "BallSocketConstraint") then
			

			
			if object.Parent.Name ~= "HumanoidRootPart" then
				local ballSocketConstraint = Instance.new(jointType)
				ballSocketConstraint.Parent = object.Parent
				if jointType ~= "Motor6D" then
					local attachment0 = Instance.new("Attachment")
					local attachment1 = Instance.new("Attachment")
					attachment0.Parent = object.Part0
					attachment1.Parent = object.Part1				
					ballSocketConstraint.Attachment0 = attachment0
					ballSocketConstraint.Attachment1 = attachment1
					attachment0.CFrame = object.C0
					attachment1.CFrame = object.C1				
				else
					local attachment0 = object.Attachment0
					if attachment0 ~= nil then
						ballSocketConstraint.C0 = object.Attachment0.CFrame
						ballSocketConstraint.C1 = object.Attachment1.CFrame
						ballSocketConstraint.Part0 = object.Attachment0.Parent
						ballSocketConstraint.Part1 = object.Attachment1.Parent
					end
				end
			end

			object:Destroy()
		end
	end
end

function removeHumanoidRootPartAttachments(player : Player)
	local character = player.Character
	local humanoidRootPart : BasePart = character:FindFirstChild("HumanoidRootPart")
	if humanoidRootPart ~= nil then
		for i,v in ipairs(humanoidRootPart:GetDescendants()) do
			if v:IsA("Sound") ~= true and not v:IsA("Trail") then
				if v.Name ~= "protected" then
					v:Destroy()
				end
			end
		end
	end
end

function attachHumanoidRootPartToRagdoll(player : Player)
	local humanoidRootPart : BasePart = player.Character.HumanoidRootPart
	local spring = Instance.new("SpringConstraint")
	local attachment0 = Instance.new("Attachment")
	attachment0.Parent = humanoidRootPart
	local attachment1 = Instance.new("Attachment")
	attachment1.Parent = player.Character.Head
	spring.Attachment0 = attachment0
	spring.Attachment1 = attachment1
	spring.LimitsEnabled = true
	spring.MaxLength = 3.5
	spring.Parent = humanoidRootPart
	spring.Name = "Spring"
end

function restoreHumanoidRootPart(player : Player)
	local humanoidRootPart = player.Character.HumanoidRootPart
	local spring : SpringConstraint = humanoidRootPart:FindFirstChild("Spring")
	local humanoid : Humanoid = player.Character.Humanoid
	if spring ~= nil then
		spring.Attachment0:Destroy()
		spring.Attachment1:Destroy()
		spring:Destroy()
	end
	for i, v in ipairs(player.Character:GetDescendants()) do
		if v:IsA("BasePart") then
			v.CFrame = CFrame.new(v.CFrame.Position)
			v.Anchored = true
			if v.Name ~= "Head" or v.Name ~= "Torso" or v.Name ~= "UpperTorso" then
				-- v.CanCollide = false
			end
			if v.Name == "HumanoidRootPart" then
				v.CanCollide = false
			end
			if v.CustomPhysicalProperties ~= nil then
				v.CustomPhysicalProperties.Density = 1
			end
		end
	end	
	
	local torso = player.Character:FindFirstChild(humanoid.RigType == Enum.HumanoidRigType.R6 and "Torso" or "UpperTorso")
	
	
	
	local motor6d : Motor6D = Instance.new("Motor6D")
	motor6d.Part0 = torso
	motor6d.Part1 = humanoidRootPart
	motor6d.Parent = humanoidRootPart
	-- motor6d.Length = 0.1
	
	humanoidRootPart.CFrame = CFrame.new(torso.CFrame.Position)
	humanoidRootPart.CanCollide = false
	
	-- Disable rotations
	for i, v in ipairs(player.Character:GetDescendants()) do
		if v:IsA("BasePart") then
			v.CFrame = CFrame.new(v.CFrame.Position)
			v.Anchored = false
		end
	end

	
	
end

function Ragdoll.unragdollPlayer(player : Player)
	setJoints(player, "Motor6D")
	local humanoid : Humanoid = player.Character.Humanoid
	humanoid:ChangeState(Enum.HumanoidStateType.Running)
	player.Character.isRagdolled.Value = 0
	player.Character.isRagdolled.Value = false
	restoreHumanoidRootPart(player)
	player.Character.HumanoidRootPart.CanCollide = false

end

function setBodyCollisions(player : Player, value)
	for i, v in ipairs(player.Character:GetDescendants()) do
		if v:IsA("BasePart") == true then
			v.CanCollide = value
		end
	end
end

function Ragdoll.ragdollPlayer(player : Player)
	setJoints(player, "BallSocketConstraint")
	local isRagdolled = player.Character:FindFirstChild("isRagdolled")
	if isRagdolled == nil then
		isRagdolled = Instance.new("BoolValue")
		isRagdolled.Parent = player.Character
		isRagdolled.Name = "isRagdolled"
	end
	if isRagdolled == true then
		return
	end
	local humanoid : Humanoid = player.Character.Humanoid
	player.Character.isRagdolled.Value = true
	removeHumanoidRootPartAttachments(player)
	attachHumanoidRootPartToRagdoll(player)
	setBodyCollisions(player, true)
end
	

return Ragdoll

image

Its always falling and getting dragged, why do Roblox do this.

If I Can’t find a solution to this directly, can writing my own character system work? (custom movement, force disablement of fall animation and implement fall checks using constant raycasts per 0.5 seconds)

image

also cant swim

1 Like