function init() shape = FindShape("loose") joints = GetShapeJoints(shape) run = true end function tick(dt) if run then local unconnectedJoints = 0 for i = 1,#joints do if GetJointOtherShape(joints[i], shape) == 0 then unconnectedJoints = unconnectedJoints + 1 end end if unconnectedJoints == #joints then for i = 1,#joints do Delete(joints[i]) end Delete(shape) run = false end end end