RagdollBindersServer
This item only works when running on the server. Server
Holds binders for Ragdoll system. Be sure to initialize on the client too. See RagdollBindersClient. Be sure to use a ServiceBag to initialize this service.
-- Server.lua
local serviceBag = require("ServiceBag")
local ragdollBindersServer = serviceBag:GetService(require("RagdollBindersServer"))
serviceBag:Init()
ragdollBindersServer.RagdollHumanoidOnDeath:SetAutomaticTagging(false)
serviceBag:Start()
Properties
Ragdoll
Apply this Binder to a humanoid to ragdoll it. Humanoid must already have Ragdollable defined.
local ragdollBinder = serviceBag:GetService(RagdollBindersClient).Ragdoll
local ragdoll = ragdollBinder:Get(humanoid)
if ragdoll then
print("Is ragdolled")
ragdollBinder:Unbind(humanoid)
else
print("Not ragdolled")
ragdollBinder:Bind(humanoid)
end
You can also use RxBinderUtils.observeBoundClass to observe whether a humanoid is ragdolled using an Observable.
info
Like any usage of Observable, be sure to give the Subscription to a Maid (or call Subscription.Destroy on it) once done with the event connection.
local maid = Maid.new()
local ragdollBinder = serviceBag:GetService(RagdollBindersClient).Ragdoll
maid:GiveTask(RxBinderUtils.observeBoundClass(ragdollBinder, humanoid):Subscribe(function(ragdoll)
if ragdoll then
print("Ragdolled!")
else
print("Not ragdolled")
end
end))
Ragdollable
Enables ragdolling on a humanoid.
RagdollHumanoidOnDeath
Automatically applies ragdoll upon humanoid death.
RagdollHumanoidOnFall
Automatically applies ragdoll upon humanoid fall.
UnragdollAutomatically
Automatically unragdolls the humanoid.