Why does my ragdoll module not work?

I was following this YouTube tutorial on how to make a ragdoll module and for some reason my module doesn’t ragdoll the person it just makes them platform stand and that’s it

local module = {}

function module.Start(Rig : Model)
	local Humanoid = Rig:FindFirstChildWhichIsA("Humanoid")
	
	for _, Motor in pairs(script.Parent:GetDescendants()) do
		if Motor:IsA("Motor6D") then
			local Socket = Instance.new("BallSocketConstraint")
			
			local Attachment0 = Instance.new("Attachment")
			local Attachment1 = Instance.new("Attachment")
			
			Attachment0.CFrame = Motor.C0
			Attachment1.CFrame = Motor.C1
			
			Attachment0.Parent = Motor.Part0
			Attachment1.Parent = Motor.Part1
			
			Socket.Attachment0 = Attachment0
			Socket.Attachment1 = Attachment1
			Socket.LimitsEnabled, Socket.TwistLimitsEnabled = true, true

			Socket.Parent = Motor.Parent
			
			Motor:Destroy()
		end
	end
	
	local properties = {
		PlatformStand = true,
		AutoRotate = false,
		WalkSpeed = 0,
		JumpPower = 0,
		JumpHeight = 0
	}
	
	module[Rig] = {} -- create 5
	
	for name, value in properties do
		module[Rig][name] = Humanoid[name]
		Humanoid[name] = value
	end
end

function module.Stop(Rig : Model)
	local properties = module[Rig]
	
	if properties then
		local Humanoid = Rig:FindFirstChildWhichIsA("Humanoid")
		
		for name, value in properties do
			Humanoid[name] = value
		end
		
		for _, Descendant in Rig:GetDescendants() do
			if Descendant:IsA("BallSocketConstraint") then
				Descendant:Destroy()
			elseif Descendant:IsA("Motor6D") then
				Descendant.Enabled = true			
			end
		end
		
		Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		
		module[Rig] = nil
	end
end

return module

this is happening cause ur not searching the player’s character for the motor6ds but ur searching the module’s parent (which will not work unless the module is parented to the players character which im assuming its not)

change this loop

for _, Motor in pairs(script.Parent:GetDescendants()) do

to this

for _, Motor in pairs(Rig:GetDescendants()) do
1 Like

probably what @LuaVMX said, also i noticed how in your start function you destroy the motors, but in stop function you try to enable them, which wont work because there is none. try to disable the motors in start function instead of destroying

1 Like

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