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