InteractiveRagdoll - Smooth Ragdoll On All Clients [R6 ONLY]

Interactive Ragdoll

A ragdoll module that runs parallel on server and client. (R6 support only) Interactive Ragdoll provides smooth ragdoll across all clients by creating a copy of the character. Works on all R6 Rigs

I WILL BE REMAKING INTERACTIVE RAGDOLL IN A WEEK TO HAVE MORE FEATURES AND BETTER OVERALL, EXPECT IT TO TAKE LONGER I WORK ON A LOT OF THINGS


Upcoming

Interactive Ragdoll will later become ONE module copy and paste into your game. It’ll unpack itself and it’ll function the same but very simplified.


Previews
Shown between 2 clients


Run into NPC

Client toggle other player ragdolls

Initialize a rig with “Character” tag


You can either use the regular ragdoll (not smooth across other clients) which is just the interactive ragdoll module. Or you can use two modules, BodyReplicator (copies the a character) and InteractiveRagdoll to create a smooth ragdoll.


InteractiveRagdoll, doesnt manipulate the motor6d’s instead it creates its own body parts and manipulates those. InteractiveRagdoll creates new body parts because If you disable a motor6d on the client it floats for some reason…


The use of these two modules creates a smooth ragdoll.
BodyReplicatorShown

In this picture you can see cameras. Cameras on Roblox don’t get replicated and we can store our body parts there for each client.
Layout


If you plan you add armor or anything that goes onto your body parts, you’d either need to have a mechanism where if you make the armor server sided, it’ll change the welds on all clients. If you have the armor client sided (recommended and optimized) you can just easily weld it to the new created body part.


Documentation

Documentation Functions
InteractiveRagdoll.new(rig: Instance, rigEnum: RigEnum?): RagdollClass
  • Creates a new Ragdoll Class
  • Rig is the Character model
  • You can get the RigEnum with InteractiveRagdoll.RigEnums
  • There is only R6, so you can only do InteractiveRagdoll.RigEnums.R6

InteractiveRagdoll:SetRigEnum(rigEnum: RigEnum): RagdollClass
  • Sets the Rig’s Enum
  • You can either do it in InteractiveRagdoll.new or in this method
  • Example Usage: InteractiveRagdoll:SetRigEnum(InteractiveRagdoll.RigEnums.R6)

InteractiveRagdoll:SetBody(bodyPartFolder: Folder?): RagdollClass
  • Used for Smoothening
  • You need a body from BodyReplicator
  • BodyReplicator.new(character: model)
  • Example Usage: InteractiveRagdoll:SetBody(BodyReplicator.new(character))

InteractiveRagdoll:Toggle(toggle: boolean?): boolean
  • Toggles the ragdoll
  • Example Usage: InteractiveRagdoll:Toggle(true)
  • If no boolean is sent through, then it toggles from on to off.

InteractiveRagdoll:CreateBoolValue(): (BoolValue, RBXScriptConnection)
  • Creates a BoolValue
  • When the boolvalue is turned on it enables ragdoll, and vice versa
  • You can create multiple if needed

Private Functions

InteractiveRagdoll:_partsCollisionEnable(rig: Model, boolean: boolean)
  • Sets ragdoll part collisions to specified boolean value

InteractiveRagdoll:_weldsEnable(rig: Model, boolean: boolean)
  • Sets ragdoll’s welds to specified boolean value

InteractiveRagdoll:_resetBody()
  • Resets ragdolls the body part references

InteractiveRagdoll:_createRagdollInstances()
  • Creates ragdoll parts/components (BallSockets, Attachments, Welds… etc.)

InteractiveRagdoll needs to run on the server and client to give smooth output.


Download here

Modules
InteractiveRagdoll.lua (7.5 KB)
BodyReplicator.rbxm (9.5 KB)

Place Download
PlaceDownload.rbxl (89.6 KB)


You can ragdoll a character using

_G.RagdollToggle(character: Model, toggle: boolean)
--[[
toggle is true or false meaning on or off
]]

If you copy and paste all the script in the place and put it inside your game it should function correctly. You first give the rig a tag “Character” and you can use _G.RagdollToggle


Latest Log

  • Copies over face instead of creating a new face
  • Attaches accessories onto new cloned head
  • Head now copies over special mesh
  • Fixed ownership error
  • Updated InteractiveRagdoll
  • Updated BodyReplicator
  • Updated PlaceDownload

Check Out my Other Modules Here


16 Likes

it’s awesome, how i can apply it to npcs?

2 Likes

Works the same a player, just give them a “Character” tag and it’ll automatically insert stuff into them

You can also do this in runtime (while game is running)

2 Likes


1 Like

I think I found the issue, it seems this resource doesn’t really like streaming enabled, should have it disabled on the demo file :sweat_smile:

demo file also takes your avatar’s rig despite having loadcharacterappearance toggled off. So I initially spawned in as R15

2 Likes

ill fix the streaming enabled feature later tmrw

I updated BodyReplicator and the PlaceDownload. It should work with StreamingEnabled now. It will freeze the joints until the body part as been rendered.

1 Like

Insane suggestion :

  • Add a function like a timer to ragdoll a character for a certain time
1 Like

You can do

-- Ragdoll for 3 seconds and then get back up
Character.InteractiveRagdoll.ToggleRagdoll.Value = true
task.wait(3)
Character.InteractiveRagdoll.ToggleRagdoll.Value = false

If you want the function version

-- Timed ragdoll function
function TimedRagdoll(ragdollTime: number)
  Character.InteractiveRagdoll.ToggleRagdoll.Value = true
  task.wait(ragdollTime)
  Character.InteractiveRagdoll.ToggleRagdoll.Value = false
end

-- Usage
TimedRagdoll(3)
1 Like

Hello! Just wondering how I’d be able to add knockback to a player while using this?

2 Likes
function Knockback(Character: Model, direction: Vector3, ragdollTime: number)
   --You can use AssemblyLinearVelocity, BodyVelocity or LinearVelocity
   Character.InteractiveRagdoll.ToggleRagdoll.Value = true -- ragdoll on
   Character.HumanoidRootPart.AssemblyLinearVelocity = direction -- knockback
   task.wait(ragdollTime) -- wait ragdolltime
   Character.InteractiveRagdoll.ToggleRagdoll.Value = false -- ragdoll off
end

-- get our target (person we want to apply knockback)
local target = workspace.Target
-- get our dealer (the person doing the knockback)
local dealer = workspace.Dealer

-- Calculate the direction from the start to target, (target - start).Unit
local direction = (target.HumanoidRootPart.Position - dealer.HumanoidRootPart.Position).Unit
local strength = 40 -- how powerful their knockback is

Knockback(target, direction * strength, 3) -- apply the knockback on the target

You can use BodyMovers, which are listed below. In the code I shown, I used AssemblyLinearVelocity.

BodyVelocity

LinearVelocity

Added updates to it so its improved

Any plans to add support for r15?

1 Like

I will probably add R15 in the future once I turn this into one module and simplified.

Does this work with the new Character Controllers provided by Roblox if the character’s an R6? Releasing Character Physics Controllers - #272 by Varonex_0 I’ve been searching for a solution to ragdolls with the character controllers for ages

1 Like

I could add support to Character Controller in the future

Thanks for the resources but I was already using body velocity. Don’t know if it’s because I’m replicating to the client or something, but it just doesn’t seem to work. (EDIT - Replicating onto the client seems to be the issue)

Other than that amazing module overall man keep it up!

uhm… I have encountered a very weird bug.
robloxapp-20240629-2109093.wmv (2.9 MB)

I copied all the scripts from the place file to my project. Do you know what’s causing the issue?

Not sure, I’m currently remaking the module so it’s easier to use and way better. It most likely will be done today or tmrw. I’m almost done, I just have to finish replication things.

1 Like