I’m trying to make a simple ragdoll system with a NPCs and I’m not sure whats going on but the physics dont seem to be working properly.
I have a video here demonstrating it.
edit: I noticed I didn’t crop the video properly. The purple block is the script that enables the isRagdolled Boolean value server sided.
Here is the code that is used here.
Lua:
local Char = script.Parent.Parent
local Humanoid = script.Parent
game:GetService("RunService").Heartbeat:Connect(function()
if Humanoid.isRagdolled.Value == true then
---//Enable Ragdoll
for _, v in pairs(Char:GetDescendants()) do
if v:IsA("Motor6D") then
local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
Att0.CFrame = v.C0
Att1.CFrame = v.C1
Att0.Parent = v.Part0
Att1.Parent = v.Part1
local BSC = Instance.new("BallSocketConstraint")
BSC.Attachment0 = Att0
BSC.Attachment1 = Att1
BSC.Parent = v.Part0
v.Enabled = false
end
end
Char.HumanoidRootPart.CanCollide = false
else
---//Disable Ragdoll
for _, v in pairs(Char:GetDescendants()) do
if v:IsA("Motor6D") then
v.Enabled = true
end
end
Char.HumanoidRootPart.CanCollide = false
end
end)
It’s when it ragdolls. It just flies away and I’m not too sure what it is, also the parts do have mass. It doesn’t have anything to do with the purple block. I never touched the dummy too.
I kinda figured out the problem, the RunService was probably too much for it so I replaced it a changed function. it doesn’t get flung which works. I’m trying collision filtering right now.