Hi I recently casually made a pretty simple ragdolling script that just disabled all of the player’s Motor6d’s and enabled all of the SocketConstraints I’ve put in my custom StarterCharacter
The SocketConstraints all have Att1 & Att2 set as a default roblox rig attachment except for the legs that use “LeftWaistAtt” and “RightWaistAtt” i don’t really know if that matters with the problem I’m having
-- Script in ServerScriptService
local replicatedstorage = game:GetService("ReplicatedStorage")
local ragdoll = replicatedstorage:WaitForChild("rdoll")
ragdoll.OnServerEvent:Connect(function(plr,bool)
plr.Character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Physics,bool)
if bool then
plr.Character:FindFirstChildOfClass("Humanoid"):ChangeState(Enum.HumanoidStateType.Ragdoll)
else
plr.Character:FindFirstChildOfClass("Humanoid"):ChangeState(Enum.HumanoidStateType.None)
end
plr.Character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
plr.Character:FindFirstChildOfClass("Humanoid").PlatformStand = bool
--if bool then
-- plr.Character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Physics,true)
--else
-- plr.Character:FindFirstChildOfClass("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping,true)
--end
for i,v in pairs(plr.Character:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
if bool then
v.Enabled = true
else
v.Enabled = false
end
end
if v:IsA("Motor6D") then
if bool then
if v.Parent.Name == "HumanoidRootPart" then return end
v.Enabled = false
else
v.Enabled = true
end
end
end
end)
-- LocalScript in StarterCharacterScripts that triggers the Server Script
local replicatedstorage = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local ragdoll = replicatedstorage:WaitForChild("rdoll")
local canrag = true
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.R then
print("dolled")
ragdoll:FireServer(canrag)
if canrag then
canrag = false
else
canrag = true
end
end
end)
While the script works pretty well (for my standards ) the limbs of the character flop and don’t collide with the ground once the character is ragdolled
I’m aware that certain named parts aren’t affected by collision when they’re under a humanoid but I don’t know if changing the limbs’ names is a great way of solving this problem considering some animations get screwed
I’ve tried looking around for awnsers but I didn’t really get far since most of them either lead to deprecated codes or just linked to really complex ragdoll modules that I didn’t really need
My end goal is to make a ragdoll system similar to the one seen in Item Asylum where players get stunned and knocked back while ragdolling once they’ve been hit
ps. I don’t really know if I should’ve specified this but I know my code isn’t compatible with r15 im just trying to make it available for r6