-- https://lua.expert/ local LocalPlayer = game:GetService("Players").LocalPlayer local t = { Head = Vector3.new(0, 1.5, 0), ["Left Arm"] = Vector3.new(-1.5, 0, 0), ["Right Arm"] = Vector3.new(1.5, 0, 0), ["Left Leg"] = Vector3.new(-0.5, -2, 0), ["Right Leg"] = Vector3.new(0.5, -2, 0) } local t2 = { Head = Vector3.new(0, 1.5, 0), UpperTorso = Vector3.new(0, 1, 0), LowerTorso = Vector3.new(0, 0, 0), LeftUpperArm = Vector3.new(-0.5, 1, 0), LeftLowerArm = Vector3.new(-0.75, 0.25, 0), LeftHand = Vector3.new(-1, -0.5, 0), RightUpperArm = Vector3.new(0.5, 1, 0), RightLowerArm = Vector3.new(0.75, 0.25, 0), RightHand = Vector3.new(1, -0.5, 0), LeftUpperLeg = Vector3.new(-0.5, -1, 0), LeftLowerLeg = Vector3.new(-0.5, -2, 0), LeftFoot = Vector3.new(-0.5, -3, 0), RightUpperLeg = Vector3.new(0.5, -1, 0), RightLowerLeg = Vector3.new(0.5, -2, 0), RightFoot = Vector3.new(0.5, -3, 0) } local function calcCOM(p1, p2) --[[ calcCOM | Line: 36 ]] local v1 = p1:FindFirstChild("HumanoidRootPart") or (p1:FindFirstChildOfClass("Humanoid") and p1:FindFirstChildOfClass("Humanoid").RootPart or (p1.PrimaryPart or p1:FindFirstChildWhichIsA("BasePart"))) if not v1 then return Vector3.new(0, 0, 0), 0 end local v2 = v1:GetMass() local sum = Vector3.new(0, 0, 0) + v1.Position * v2 local sum2 = 0 + v2 local v3 = p1:FindFirstChild("Torso") or p1:FindFirstChild("UpperTorso") if v3 then local v4 = v3:GetMass() sum = sum + v3.Position * v4 sum2 = sum2 + v4 end for k, v in pairs(p2) do local v5 = p1:FindFirstChild(k) if v5 then local Position = ((v3 or v1).CFrame * CFrame.new(v)).Position local v6 = v5:GetMass() sum = sum + Position * v6 sum2 = sum2 + v6 end end for k, v in pairs(p1:GetChildren()) do if v:IsA("Tool") then for k2, v4 in pairs(v:GetDescendants()) do if v4:IsA("BasePart") then local v7 = v4:GetMass() sum = sum + v4.Position * v7 sum2 = sum2 + v7 end end end end if sum2 == 0 then return Vector3.new(0, 0, 0), 0 end return sum / sum2, sum2 end shared.com_balancer_objs = shared.com_balancer_objs or {} local function setCOM(p1, p2, p3) --[[ setCOM | Line: 87 | Upvalues: t2 (copy), t (copy), calcCOM (copy) ]] if not (p1 and p1:IsA("Model")) then return end if shared.com_balancer_objs[p1] then shared.com_balancer_objs[p1]:Destroy() shared.com_balancer_objs[p1] = nil end local v1 = p1:FindFirstChild("HumanoidRootPart") or (p1:FindFirstChildOfClass("Humanoid") and p1:FindFirstChildOfClass("Humanoid").RootPart or (p1.PrimaryPart or p1:FindFirstChildWhichIsA("BasePart"))) if not v1 then return end local Humanoid = p1:FindFirstChildOfClass("Humanoid") local v3 = (if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then "R15" else "R6") == "R15" and t2 or t for k, v in pairs(p1:GetChildren()) do if v:IsA("BasePart") then v.Massless = false end end v1.CustomPhysicalProperties = PhysicalProperties.new(Enum.Material.Plastic) local v4, v5 = calcCOM(p1, v3) if (v4 - v1.AssemblyCenterOfMass).Magnitude < 0.11 then return end for k, v in pairs(p1:GetChildren()) do if v:IsA("BasePart") and (v ~= v1 and v.Name ~= "COM_BALANCER") then v.Massless = true end end local COM_BALANCER = Instance.new("Part") shared.com_balancer_objs[p1] = COM_BALANCER COM_BALANCER.Name = "COM_BALANCER" COM_BALANCER.Size = Vector3.new(1, 1, 1) COM_BALANCER.CustomPhysicalProperties = PhysicalProperties.new(v5 * (if p3 then 50 else 1), 0, 0) COM_BALANCER.CanCollide = false COM_BALANCER.Anchored = false COM_BALANCER.Transparency = if p2 then 0.3 else 1 COM_BALANCER.Parent = p1 v1.CustomPhysicalProperties = PhysicalProperties.new(0.0001, v1.CurrentPhysicalProperties.Friction, v1.CurrentPhysicalProperties.Elasticity) local Weld = Instance.new("Weld") Weld.Part0 = COM_BALANCER Weld.Part1 = v1 Weld.Parent = COM_BALANCER COM_BALANCER.Position = v4 end local function setupCharacter(p1) --[[ setupCharacter | Line: 140 | Upvalues: setCOM (copy) ]] if p1 then task.wait(1) setCOM(p1, false, true) p1.ChildAdded:Connect(function(p12) --[[ Line: 145 | Upvalues: setCOM (ref), p1 (copy) ]] if p12.Name == "COM_BALANCER" then return end task.wait() setCOM(p1, false, true) end) p1.ChildRemoved:Connect(function(p12) --[[ Line: 152 | Upvalues: setCOM (ref), p1 (copy) ]] if p12.Name == "COM_BALANCER" then return end task.wait() setCOM(p1, false, true) end) end end setupCharacter(LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()) LocalPlayer.CharacterAdded:Connect(function(p1) --[[ Line: 161 | Upvalues: setupCharacter (copy) ]] setupCharacter(p1) end)