Hi! I was once wandering around devforum when I found this post, I decided it was interesting so I tried it (both the original and community version) and I found some things that could probably be improved on. I’ve already made and tested a few different versions, but this one (link attached below) it the latest one.
Reason for me to make my own version
Like the original and community version, it ragdolls every rig type. Some issues I found with these 2 scripts were, for example, shiftlock moves the character while ragdoll, camera shaking a lot during ragdoll, not compatible with npcs, etc. I found this forum quite useful so I fixed all of those!
Install & Setup Character Rig
For basic setup, you would want to put it in somewhere you can require it from, I recommend ServerStorage. To have a ragdollable character, you have to first setup the rigs.
local ServerStorage = game:GetService("ServerStorage")
local Module = require(ServerStorage.Ragdoll)
Module:RigCharacter(character) -- NPC characters works too!
The character can be taken from CharacterAppearanceLoaded, or just script.Parent
if it’s a script in an NPC.
*Note: Write the code in server scripts!
Module Usage
local ServerStorage = game:GetService("ServerStorage")
local Module = require(ServerStorage.Ragdoll)
local knockback = {}
knockback.Direction = Part.CFrame.LookVector
knockback.Strength = 60
Module:Ragdoll(character, knockback, time)
Again, the character can be a player or an NPC. The character must be rigged beforehand, or nothing would happen. I’ll explain ‘knockback’ in detail, ‘time’ is just how many seconds to wait until the character unragdolls. You can leave it blank if you don’t want it to unragdoll.
For knockback, it has 2 properties, Direction and Strength. Direction is simple, you can either have a set direction with Vector3.new()
or you can use CFrame.LookVector
, for example, launching an enemy at the direction your character is facing. Strength is self-explanatory, it’s basically how large the knockback will be, the higher it is, the further the character gets knocked back.
Like ‘time’, you can leave it blank or nil
if you don’t want the knockback, and it will simply just ragdoll without any knockback.
(It was made so I could apply knockback easier, not really necessary though)
One thing you may also want to take note is when a r6 ragdoll lands on a thin platform of > 1~2 studs, it sometimes may glitch through the platform since it has a custom collider and it’s smaller than the default body part.
*Write the code in server scripts!
Links
Module: https://create.roblox.com/store/asset/18723516623/Ragdoll-Module
Testing Experience: Ragdoll Test - Roblox
(Edit: To clarify, I actually rewrote 70~80% of the code, but some main components are still the same hence I posted the remake here instead of a new post)
Last updated at 7/30/2024 (changes: slightly less lag + smooth unragdoll system)
Scroll up for the original version, this is only a remake of this module!