Universal Ragdoll Script
Key RequiredUniversal

Universal Ragdoll Script

Universal Scriptsirreefsirreef 1.8K views 712 executesUpdated Mar 13, 2026
Unrated
00
Lua Script•102 lines (2372 chars)
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer

-- State
local isRagdolled = false
local motorBackup = {}

local function getCharacter()
	return player.Character or player.CharacterAdded:Wait()
end

-- Ragdoll function
local function toggleRagdoll(forceState)
	local character = getCharacter()
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if not humanoid or humanoid.Health <= 0 then return end

	local root = character:FindFirstChild("HumanoidRootPart")
	if not root then return end

	local target
	if forceState == true then
		target = true
	elseif forceState == false then
		target = false
	else
		target = not isRagdolled
	end

	if target and not isRagdolled then
		humanoid:ChangeState(Enum.HumanoidStateType.Physics)
		humanoid.AutoRotate = false

		motorBackup = {}

		for _, joint in ipairs(character:GetDescendants()) do
			if joint:IsA("Motor6D") then
				local socket = Instance.new("BallSocketConstraint")
				local a1 = Instance.new("Attachment")
				local a2 = Instance.new("Attachment")

				a1.Name = "RagdollAttachment"
				a2.Name = "RagdollAttachment"

				a1.CFrame = joint.C0
				a2.CFrame = joint.C1
				a1.Parent = joint.Part0
				a2.Parent = joint.Part1

				socket.Attachment0 = a1
				socket.Attachment1 = a2
				socket.Parent = joint.Parent
				socket.LimitsEnabled = true
				socket.TwistLimitsEnabled = true

				motorBackup[joint] = true
				joint.Enabled = false
			end
		end

		root.Velocity = Vector3.new(0, 15, 0)

		isRagdolled = true

	elseif not target and isRagdolled then
		for motor in pairs(motorBackup) do
			motor.Enabled = true
		end
		motorBackup = {}

		humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		humanoid.AutoRotate = true

		for _, item in ipairs(character:GetDescendants()) do
			if item:IsA("BallSocketConstraint") then
				item:Destroy()
			elseif item:IsA("Attachment") and item.Name == "RagdollAttachment" then
				item:Destroy()
			end
		end

		isRagdolled = false
	end
end

player.CharacterAdded:Connect(function(char)
	isRagdolled = false
	motorBackup = {}
end)

--Binds
UserInputService.InputBegan:Connect(function(input, gp)
	if gp then return end

	if input.KeyCode == Enum.KeyCode.R then
		toggleRagdoll(true)
	elseif input.KeyCode == Enum.KeyCode.C then
		toggleRagdoll(false)
	end
end)

Features & Information

Script that allows for ragdolling in R6 and R15 using R and C.

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts