I found a ragdoll script on the dev forums (script bellow) that works fine when i use it on a dummy who's dead, but recently I tried using it on a dummy who is alive so i can have a system where you kick them and they fall over. When I tried this though, the dummy sort of floats into the sky and flails around a bunch with their limbs phasing through eachother. When the dummy dies, the ragdoll starts acting normally. The script is exactly the same as I use for when they die. I also tried deleting all the dummy's scripts to see if they were the problem, but they weren't. Also, this script is a server script, not a local script. Why is this happening? can I fix it?

local rs = game:GetService("ReplicatedStorage")
local KickRagdoll = rs:WaitForChild("KickRagdoll")

local function KickFunction(player, part)
	print(part)
	part.parent.StunLevel.Value = 3
	local d = part.parent:GetDescendants()
	for i=1,#d do
		local desc = d[i]
		if desc:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local part0 = desc.Part0
			local joint_name = desc.Name
			local attachment0 = desc.Parent:FindFirstChild(joint_name.."Attachment") or desc.Parent:FindFirstChild(joint_name.."RigAttachment")
			local attachment1 = part0:FindFirstChild(joint_name.."Attachment") or part0:FindFirstChild(joint_name.."RigAttachment")
			if attachment0 and attachment1 then
				socket.Attachment0, socket.Attachment1 = attachment0, attachment1
				socket.Parent = desc.Parent
				desc:Destroy()
			end	
		end
	end
end
	
KickRagdoll.OnServerEvent:Connect(KickFunction)

4 comments

0

You may solve this by chaning the humanoid state of the npc https://developer.roblox.com/en-us/api-reference/enum/HumanoidStateType

0

What state should I change it to? it says "none" is an unusable placeholder

0

I changed the state to physics, it now fixes itself after a few seconds, but the dummy still flies as soon as they are ragdolled.

0

This isn't code you found on the developer forums support