Hello Developers!
I've made a ragdoll part, basically, when you touch the ragdoll part, you will as the name suggest, ragdoll for three seconds before getting up, the Issues are:
- Only one of the body parts get ragdolled
- For some reason, when you get teleported via CFrame while being ragdolled, only the HumanoidRootPart Teleports there and not the rest of the bodyparts, the HumanoidRootPart also moves towards the other bodyparts after being teleported, but thats probably just expected behaviour
(Also If your wondering, how the ragdoll part works Is that there Is a script that whenever the player touches the part, a script Inside the said script gets cloned and enabled)
Script:
local NPC = script.Parent
if script.Enabled == true then
wait(0.1)
NPC.Humanoid.PlatformStand = true
NPC.Humanoid.BreakJointsOnDeath = false
for _, v in pairs(NPC:GetDescendants()) do
if v:IsA("Motor6D") then
local Attachment0, Attachment1 = Instance.new("Attachment"), Instance.new("Attachment")
game:GetService("Debris"):AddItem(Attachment0,10)
game:GetService("Debris"):AddItem(Attachment1,10)
Attachment0.CFrame = v.C0
Attachment1.CFrame = v.C1
Attachment0.Parent = v.Part0
Attachment1.Parent = v.Part1
local BallSocketConstraint = Instance.new("BallSocketConstraint")
game:GetService("Debris"):AddItem(BallSocketConstraint,10)
BallSocketConstraint.Attachment0 = Attachment0
BallSocketConstraint.Attachment1 = Attachment1
BallSocketConstraint.Parent = v.Parent
v.Enabled = false
wait(3)
game:GetService("Debris"):AddItem(Attachment0,0)
game:GetService("Debris"):AddItem(Attachment1,0)
game:GetService("Debris"):AddItem(BallSocketConstraint,0)
v.Enabled = true
NPC.Humanoid.BreakJointsOnDeath = true
NPC.HumanoidRootPart.CanCollide = true
NPC.Humanoid.PlatformStand = false
end
NPC.HumanoidRootPart.CanCollide = false
end
end
