Hi AZWildcat1290 ,
I have found that you used Xrm.Page in your code and it is deprecated. you can use executionContext instead.
You have to call the function from both onload of the form and onchange of that multi-select optionset field
Here is my working example
I have set a field in the details tab(contact preferences section) of accounts form and use it to hide/show the sections
Uncheck the visible by default in all sections you want to show/hide.

I have used the below code to accomplish the task
function showSections(executionContext) {
var formContext = executionContext.getFormContext();
var sections = formContext.getAttribute("new_sectionstoshow");
var getSections = sections.getValue();
let tabObj = formContext.ui.tabs.get("DETAILS_TAB");
if (getSections !== null) {
getSections.forEach(element => {
if (getSections.includes(element) === true) {
switch (element) {
case 1:
tabObj.sections.get("COMPANY_PROFILE").setVisible(true);
break;
case 2:
tabObj.sections.get("DETAILS_TAB_section_6").setVisible(true);
break;
case 3:
tabObj.sections.get("BILLING").setVisible(true);
break;
case 4:
tabObj.sections.get("SHIPPING").setVisible(true);
break;
default:
tabObj.sections.get("COMPANY_PROFILE").setVisible(false);
tabObj.sections.get("DETAILS_TAB_section_6").setVisible(false);
tabObj.sections.get("BILLING").setVisible(false);
tabObj.sections.get("SHIPPING").setVisible(false);
break;
}
}
});
if (getSections.includes(1) !== true) {
tabObj.sections.get("COMPANY_PROFILE").setVisible(false);
} else if (getSections.includes(2) !== true) {
tabObj.sections.get("DETAILS_TAB_section_6").setVisible(false);
} else if (getSections.includes(3) !== true) {
tabObj.sections.get("BILLING").setVisible(false);
} else if (getSections.includes(4) !== true) {
tabObj.sections.get("SHIPPING").setVisible(false);
}
} else {
tabObj.sections.get("COMPANY_PROFILE").setVisible(false);
tabObj.sections.get("DETAILS_TAB_section_6").setVisible(false);
tabObj.sections.get("BILLING").setVisible(false);
tabObj.sections.get("SHIPPING").setVisible(false);
}
}
And it worked as expected for me
below is the gif

If this answer helps you, like and verify my answer