Creating a ragdoll
Creating a ragdoll with RagdollV9 only takes a few lines
local ragapi = require(game.ReplicatedStorage:WaitForChild("RagdollAPI"))
ragapi.buildRagdoll(character, rigtype, UseAnimationConstraints)
rag.waitForRagdoll(character, 100)
print("Ragdoll built")
Sudio beta feature
UseAnimationConstraints replaces all Motor6D joints with physically simulated AnimationConstraints.
Please concider reading this devforum post to learn about AnimationConstraints.
Rig types
ragapi.rigType.stable:
Joints will be more restricted, resulting in an overall more stable ragdoll
ragapi.rigType.dynamic:
Joints will be less restrictive, resulting in more dynamic posing
Toggling Ragdoll State
Changing the ragdoll state of a charcter can be done in 2 ways.
You could set the state directaly, or you can use the ragdoll / unRagdoll functions
local ragapi = require(game.ReplicatedStorage:WaitForChild("RagdollAPI"))
ragapi.setRagdoll(character, state)
rag.toggleRagdoll(character)
ragapi.ragdoll(character)
ragapi.unRagdoll(character)
Checking and waiting
You can check if a character is a ragdoll using the ragapi.isRagdoll(character) function.
Similarly, you can use ragapi.isRagdolled(character) to check if a character is in the ragdoll state.
You can also use ragapi.waitForRagdoll(character, maxtime) to wait for a character ragdoll to be built.
Events
RagdollV9 has a few events that you can use to listen for ragdoll state changes.
You can use ragapi.onRagdollBuilt(character) to listen for when a character's ragdoll is built.
You can use ragapi.onRagdoll(character) to listen for when a character is ragdolled, and ragapi.onUnRagdoll(character) to listen for when a character is unragdolled.
local ragapi = require(game.ReplicatedStorage:WaitForChild("RagdollAPI"))
ragapi.waitForBindables()
ragapi.onRagdollBuilt(character):Connect(function()
ragapi.ragdoll(character)
end)