Hello developers. I’m making a ragdoll system using a module script and I’ve run into a problem. Instead of ragdoll-ing the character It would kill the humanoid and I’m so confused that its stressing me out. Please help me!
Code:
-- Services --
local Doll = {}
local Replicated = game:GetService('ReplicatedStorage')
--
-- Fire Server --
local Remotes = Replicated:FindFirstChild('Remotes').Hitbox
Doll.Fall = function(Character,Player)
Remotes.Doll:FireClient(Player,'Fall')
--
Character.Humanoid.JumpPower = 0
Character.Humanoid.RequireNeck = false
for _,V in pairs(Character:GetDescendants()) do
if V:IsA('Motor6D') then
--
local Att1 = Instance.new('Attachment')
local Att2 = Instance.new('Attachment')
local BSocket = Instance.new('BallSocketConstraint')
--
Att1.Name = 'Att1'
Att1.CFrame = V.C0
Att1.Parent = V.Part0
--
Att2.Name = 'Att2'
Att2.CFrame = V.C1
Att2.Parent = V.Part1
--
BSocket.Name = 'BSocket'
BSocket.Attachment0 = Att1
BSocket.Attachment1 = Att2
BSocket.LimitsEnabled = true
BSocket.TwistLimitsEnabled = true
--
V.Part0 = nil
end
end
end
--
function MakeM6D()
local M6D = Instance.new('Motor6D')
M6D.MaxVelocity = .1
return M6D
end
--
Doll.Stand = function(Character,Player,Humanoid)
--
Character.Humanoid.JumpPower = 50
for _,V in pairs(Character:GetDescendants()) do
if V.Name == 'Att1' or V.Name == 'Att2' or V:IsA('BallSocketConstraint') then
print(V)
V:Destroy()
end
end
--
for _,V in pairs(Character:GetDescendants()) do
if V:IsA('Motor6D') then
V.Part0 = V.Parent
end
end
Remotes.Doll:FireClient(Player,'Stand')
end
return Doll
--