Hello There!
I recently made a Combat system for my game and added the feature to ragdoll when you where hitted by the last Combo Hit, it works well but my problem is thats it takes a while for the Dummy to get up and its quite anoying.
Heres a clip:
robloxapp-20211003-1809022.wmv (4.6 MB)
Heres my piece of Code:
function Ragdoll(eCharacter, aCharacter)
for i, v in pairs(eCharacter:GetChildren()) do
for _, v2 in pairs(v:GetChildren()) do
if v2:IsA("Motor6D") and v2.Parent.Name ~= "HumanoidRootPart" and v2.Parent.Name ~= "Head" and v2.Parent.Name ~= "RightHand" and v2.Parent.Name ~= "LeftHand" and v2.Parent.Name ~= "RightFoot" and v2.Parent.Name ~= "LeftFoot" then
local Socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
eCharacterForRagdoll = eCharacter
a1.Parent = v2.Part0
a2.Parent = v2.Part1
Socket.Parent = v2.Parent
Socket.Attachment0 = a1
Socket.Attachment1 = a2
a1.CFrame = v2.C0
a2.CFrame = v2.C1
Socket.LimitsEnabled = true
Socket.TwistLimitsEnabled = true
v2:Destroy()
end
end
end
eCharacter.Humanoid.RequiresNeck = false
eCharacter.Humanoid.Sit = true
aCharacter.Humanoid.WalkSpeed = 16
aCharacter.Humanoid.JumpPower = 50
end
function UnRagdoll(Time)
local eCharacter = eCharacterForRagdoll
wait(Time)
if eCharacterForRagdoll ~= nil and eCharacter ~= nil and eCharacter.Humanoid.Health ~= 0 then
for i, v in pairs(eCharacter:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v.UpperAngle = 0
v.TwistUpperAngle = 0
v.TwistLowerAngle = 0
local Joins = Instance.new("Motor6D", v.Parent)
Joins.Part0 = v.Attachment0.Parent
Joins.Part1 = v.Attachment1.Parent
Joins.C0 = v.Attachment0.CFrame
Joins.C1 = v.Attachment1.CFrame
v:Destroy()
wait()
end
end
eCharacter.Humanoid.Sit = false
wait()
eCharacter.Humanoid.PlatformStand = true
wait()
eCharacter.Humanoid.PlatformStand = false
eCharacterForRagdoll = nil
end
end
Is there any Solution on this Problem?
Any help whould be greatly appreciated!
Thanks for your time!