Ragdoll flying after applying a force

I’m trying to make a launching system where a force is applied to a ragdoll. However, doing this cause the character to fly. I tried to use PlatformStand and Massless properties but that doesn’t seem to work. If anyone knows the cause of this issue, please let me know!

Script:

local function applyRagdoll(rig)
	for _, v in pairs(rig: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()
		end
	end
end

local function onLaunch(player, force)
	applyRagdoll(Rig)
	local root = Rig.HumanoidRootPart
	local attachment0 = root.Attachment0
	local attachment1 = root.Attachment1
	
	local vectorForce = Instance.new("VectorForce")
	vectorForce.Parent = root
	vectorForce.Force = root.CFrame.LookVector * force
	vectorForce.Attachment0 = attachment0
	vectorForce.Attachment1 = attachment1
	
	task.wait(.5)
	vectorForce:Destroy()
end

I don’t think you want the ragdoll to be massless. Also for things like this you should use ApplyImpulse() method. It’s perfectly suited for things that are based on a single application of force and then letting physics take over, like a jump or launching something such as in this case.

3 Likes

I was using ApplyImpulse before this to see if it stops the flying but the effect is the same as you’re seeing in the video. Making the ragdoll massless or not doesn’t seem to make a difference as well so I removed it.

Found a fix - just changed the Humanoid state and it worked. Anyways, thank you for your suggestion!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.