Hey! So I made a ragdoll script that can ragdoll players.
Here is the code:
RAGDOLL:
hum.RequiresNeck = false
pcall(function()
RS.Handlers.RagdollHandler:FireClient(getPlayer(char),true)
end)
for _, v in pairs(char:GetDescendants()) do --ragdoll
if v:IsA("Motor6D") then
if v.Parent.Name == "HumanoidRootPart" then
else
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Part0
v.Enabled = false
end
end
end
Here is the client remote event
RS.Handlers.RagdollHandler.OnClientEvent:Connect(function(ragdoll)
local char = plrs.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid")
if ragdoll then
hum:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
hum:ChangeState(Enum.HumanoidStateType.PlatformStanding,false)
hum:ChangeState(Enum.HumanoidStateType.Ragdoll)
else
hum:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
hum:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)
ISSUES:
- When ragdolled the players limbs go through the body.
- Dummy’s cannot get ragdolled I’ve searched for a while and found no solutions. And I’m aware that I cant fire a client event on a dummy obviously.
- Is there a way to ragdoll that does not require me firing a remote event to the client?
visual examples of the issues:
https://gyazo.com/f1a9cf4a5d9891788b942348761e2447
https://gyazo.com/f093ab06627788ad0237aaff63ae3f7b