Push Tool | Ragdoll Help

I have modified this script below to make it so the player ragdolls when pushed, ignore the bodyvelocity.

  • My current issue is that the torso is stuck in the air keeping the ragdoll from falling.
  • I also want to be able to move the ragdoll a small studs facing away from the person with the push tool.

The Ragdoll() etc. are from a seperate module script which doesn’t seem to be the issue for the script.

 local ms = game:GetService("MarketplaceService")
local Ragdoll = require(game.ServerStorage:WaitForChild("Ragdoll"))
local pushID = 203646445

local PushTool = script.Parent.Parent.Parent

local debounce = false
local HitDB = false



script.Parent.OnServerEvent:Connect(function(player, toPush)

	local playerRoot = player.Character:FindFirstChild("HumanoidRootPart")
	local playerHuman = player.Character:FindFirstChild("Humanoid")
	
	local pushRoot = toPush:FindFirstChild("HumanoidRootPart")
	local toPushHuman = toPush:FindFirstChild("Humanoid")
	
	local Animator = playerHuman:FindFirstChild("Animator")
	
	local animationID = script.Parent.Parent.Parent:FindFirstChild("Animation")
	local pushAnimationTrack = Animator:LoadAnimation(animationID)
	pushAnimationTrack:Play()

	if not debounce and (playerRoot and not playerRoot:FindFirstChild("PushF") and pushRoot and not pushRoot:FindFirstChild("PushF") and (playerRoot.Position - pushRoot.Position).Magnitude <= 10) then
		debounce = true
		
		toPushHuman:ChangeState(Enum.HumanoidStateType.Ragdoll)

		local motors = Ragdoll.CreateJoints(toPush)
		Ragdoll.Ragdoll(toPush)
		Ragdoll.SetMotorsEnabled(motors, false)
		
		--[[
		local pushF = Instance.new("BodyVelocity")
		pushF.Name = "PushF"
		pushF.MaxForce = Vector3.new(1000000, 1000000, 1000000)
		pushF.Velocity = -pushRoot.CFrame.lookVector
		pushF.Parent = pushRoot
		]]--
		
		wait(2.5)
		
		-- pushF:Destroy()
		Ragdoll.DestroyJoints(toPush)
		Ragdoll.SetMotorsEnabled(motors, true)
		Ragdoll.UnRagdoll(toPush)

		toPushHuman:ChangeState(Enum.HumanoidStateType.PlatformStanding)
		
		wait(1)
		debounce = false
	end
end)

Video:
https://i.gyazo.com/066475c46ba25db263c2470514452c31.mp4

1 Like

this part applies a force to push the dummy backwards?

I don’t need to use this part of code, I realised I can use ApplyImpulse() Instead, my issue is because of the attachments or something else. (but yes it does not how I like)

1 Like

I’m not sure what you should do about the floating, but you can launch the ragdoll using AssemblyLinearVelocity. You would do something like

pushF.AssemblyLinearVelocity = pushRoot.CFrame.LookVector * -100 --Play around with -100 to change how far you want it to launch

Hope this helped a bit?

1 Like

I’ll give it a go but really my issue is to do with the floating but thanks again.