#Ragdoll problem

1 messages · Page 1 of 1 (latest)

burnt torrent
#

whenever i leave ragdoll, my character does a backflip , only happens on roblox but not studio



function Ragdoll.RagdollPlayer(player,char)
    if not player or not char then return end
    
    Ragdoll.StopPlayingAnimations(char)
    
    local hum = char:FindFirstChild("Humanoid")
    local HRP = char:FindFirstChild("HumanoidRootPart")
    local torso = char:FindFirstChild("Torso")
    
    hum.AutoRotate = false

    local weld = Instance.new("WeldConstraint")
    weld.Name = player.Name
    weld.Part0 = torso
    weld.Part1 = HRP
    weld.Parent = HRP
    weld.Enabled = true

    BackpackVisibility:FireClient(player,false)
    
    Ragdoll.TurnColliders(char, true)
    Ragdoll.TurnM6D(char, false)
    
    
    if hum:GetAttribute("InCarry") then
        DownedInCarry:Fire(player)
    end

    local DownedGUI = DownedVFX:Clone()
    DownedGUI.Parent = HRP
    

    for _,m6d in ipairs(char:GetDescendants()) do

        if not m6d:IsA("Motor6D") then continue end

        local att1 = Instance.new("Attachment")
        local att2 = Instance.new("Attachment")

        att1.CFrame = m6d.C0
        att2.CFrame = m6d.C1

        att1.Parent = m6d.Part0
        att2.Parent = m6d.Part1


        local socket = Instance.new("BallSocketConstraint")
        socket.Attachment0 = att1
        socket.Attachment1 = att2
        socket.LimitsEnabled = true
        socket.TwistLimitsEnabled = true
        socket.Parent = m6d.Parent

        table.insert(joints[player.Name], att1)
        table.insert(joints[player.Name], att2)
        table.insert(joints[player.Name], socket)
    end

    Ragdoll.ApplyVFX(char)
    
    
    Ragdoll.CheckRagdollTimer(hum)
    
end
#

this is the unragdoll part:


function Ragdoll.UnragdollPlayer(player, char)
    Ragdoll.DestroyJoints(player)
    Ragdoll.TurnM6D(char,true)
    local hum = char:FindFirstChild("Humanoid")
    local HRP = char:FindFirstChild("HumanoidRootPart")
    Ragdoll.TurnColliders(char, false)
    if HRP:FindFirstChild(player.Name) then HRP:FindFirstChild(player.Name):Destroy() end
    if HRP:FindFirstChildOfClass("BillboardGui") then HRP:FindFirstChildOfClass("BillboardGui"):Destroy() end 
    BackpackVisibility:FireClient(player,true)
    hum:ChangeState(Enum.HumanoidStateType.GettingUp)
    hum:SetAttribute("Downed", false)
    hum.AutoRotate = true
end