Checking and Waiting
Functions to validate the status of a character.
ragapi.isRagdoll(character): Checks if the character has a ragdoll rig built.
ragapi.isRagdolled(character): Checks if the character is currently in the floppy physical state.
ragapi.waitForRagdoll(character, maxtime): Yields until the rig is finished building.
Events
Use these events to trigger custom logic (like sound effects or UI changes) when a character's state changes.
local ragapi = require(game.ReplicatedStorage:WaitForChild("RagdollAPI"))
ragapi.waitForBindables()
-- Fired when the physics rig is first created
ragapi.onRagdollBuilt():Connect(function(character)
print(character.Name .. " is ready to ragdoll!")
end)
-- Fired when state changes
ragapi.onRagdoll():Connect(function(character)
print("Character fell over")
end)
ragapi.onUnragdoll():Connect(function(character)
print("Character got up")
end)
Physics & Advanced