#Ragdoll Issue

1 messages · Page 1 of 1 (latest)

lost surge
#

For some reason, whenever i stop ragdolling it doesn't let me get up and i have NO idea on what the hell is going on 😭 , It might be an issue with the states just like what other said in #📜︱scripting but that didnt fix it at all.

#

the main issue is in here (i think):

function ragdoll.Stop(character, player)
    character:SetAttribute("Ragdolled", false)

    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if not humanoid then return end

    humanoid.PlatformStand = false
    humanoid.UseJumpPower = true
    humanoid.AutoRotate = true
    humanoid.WalkSpeed = 16
    humanoid.JumpPower = 50

    for _, v in pairs(character:GetDescendants()) do
        if v:IsA("BallSocketConstraint") or v:IsA("Attachment") or v:IsA("WeldConstraint") then
            v:Destroy()
        elseif v:IsA("Motor6D") then
            v.Enabled = true
        end
    end

    for _, part in character:GetChildren() do
        if part:IsA("BasePart") and part.Name:find(COLLIDER_NAME) then
            part:Destroy()
        end
    end

    for _, part in character:GetDescendants() do
        if part:IsA("BasePart") then
            part.AssemblyLinearVelocity = Vector3.zero
            part.AssemblyAngularVelocity = Vector3.zero
        end
    end
    
    humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
    --humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
    humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
end
cunning canopy
#

owahhh finally you came here

#

i can see tons of issues

#

youre enabling Motor6Ds while still in ragdoll state which can cause conflicts

setting states and changing them immediately doesnt give the humanoid time to process

you skip the RootJoint in ragdoll start but dont handle it properly in stop

firstly fix the stop function

function ragdoll.Stop(character, player)
    character:SetAttribute("Ragdolled", false)
    
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if not humanoid then return end
    
    for _, v in pairs(character:GetDescendants()) do
        if v:IsA("BallSocketConstraint") or v:IsA("Attachment") or v:IsA("WeldConstraint") then
            v:Destroy()
        end
    end
    
    for _, part in character:GetChildren() do
        if part:IsA("BasePart") and part.Name:find(COLLIDER_NAME) then
            part:Destroy()
        end
    end
    
    for _, part in character:GetDescendants() do
        if part:IsA("BasePart") then
            part.AssemblyLinearVelocity = Vector3.zero
            part.AssemblyAngularVelocity = Vector3.zero
        end
    end
    
    task.wait()
    
    for _, v in pairs(character:GetDescendants()) do
        if v:IsA("Motor6D") then
            v.Enabled = true
        end
    end
    
    humanoid.PlatformStand = false
    humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true)
    
    task.wait()
    
    humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
    humanoid.AutoRotate = true
    humanoid.WalkSpeed = 16
    humanoid.JumpPower = 50
    humanoid.UseJumpPower = true
end
#

here u go

#

@lost surge lemme know if fixed

lost surge
#

ill try this out thanks!

cunning canopy
#

Welcome

lost surge
cunning canopy
#

the issue is the task.wait() calls are causing problems

function ragdoll.Stop(character, player)
    character:SetAttribute("Ragdolled", false)
    
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if not humanoid then return end
    
    for _, v in pairs(character:GetDescendants()) do
        if v:IsA("BallSocketConstraint") or v:IsA("Attachment") or v:IsA("WeldConstraint") then
            v:Destroy()
        elseif v:IsA("Motor6D") then
            v.Enabled = true
        end
    end
    
    for _, part in character:GetChildren() do
        if part:IsA("BasePart") and part.Name:find(COLLIDER_NAME) then
            part:Destroy()
        end
    end
    
    for _, part in character:GetDescendants() do
        if part:IsA("BasePart") then
            part.AssemblyLinearVelocity = Vector3.zero
            part.AssemblyAngularVelocity = Vector3.zero
        end
    end
    
    humanoid.PlatformStand = false
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, false)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
    
    humanoid.AutoRotate = true
    humanoid.WalkSpeed = 16
    humanoid.JumpPower = 50
    humanoid.UseJumpPower = true
    
    humanoid:ChangeState(Enum.HumanoidStateType.Running)
end
#

try this

lost surge
cunning canopy
#
function ragdoll.Stop(character, player)
    --existing cleanup code
    
    humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true)  -- keep this enabled
    humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
    
    humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
    -- or try humanoid:ChangeState(Enum.HumanoidStateType.Running)
    
    humanoid.PlatformStand = false
    -- your code
end
lost surge
#

and one thing i found is that, even if its at Running, it Changes BACK to FallingDown