I've tried a lot of things to fix it, but really am not sure what is causing the error. I'm guessing somehow an invalid reference is created which stops the script. Maybe some fresh eyes can spot the problem.
scn b3ToiletReplacerScriptSmallref NewToiletref Toiletref Trigerfloat pxfloat pyfloat pzfloat angzfloat angxfloat angyshort onceshort initshort buttonshort activeshort indexshort numbershort smallshort homebegin ScriptEffectStart showmessage b3options set active to 0 player.additem b3ToiletPaper01 1 1Endbegin ScriptEffectUpdateif active == 0 set button to getbuttonpressedif button == 0 set active to 1elseif button == 1 set active to 1 set home to 1elseif button == 2 showmessage b3Remove set active to 4elseif button == 3 set active to 4endifendifif active == 1set Toilet to getfirstref 0 1label 10if(Toilet)if Toilet.getdisabled == 0 else set Toilet to ArmorCombatHelmet set Toilet to getnextref goto 10 endif if toilet.getisid DrinkToilet || toilet.getisid DrinkToiletSettlement set NewToilet to movetoref.placeatme b3SitToiletDirty elseif toilet.getisid DrinkToiletClean set NewToilet to movetoref.placeatme b3SitToiletClean elseif toilet.getisid DrinkToiletCleaner set NewToilet to movetoref.placeatme b3SitToiletCleaner elseif toilet.getisid DrinkToiletMetal set NewToilet to movetoref.placeatme b3SitToiletMetalR set small to 1 elseif toilet.getisid DrinkToiletMetalV101 set NewToilet to movetoref.placeatme b3SitToiletMetal set small to 1 else set Toilet to ArmorCombatHelmet set Toilet to getnextref goto 10 endif set px to Toilet.getpos x set py to Toilet.getpos y set pz to Toilet.getpos z set angz to Toilet.getangle z set angy to Toilet.getangle y set angx to Toilet.getangle x Toilet.disable NewToilet.disable NewToilet.moveto player NewToilet.setpos x px NewToilet.setpos y py NewToilet.setpos z pz NewToilet.setangle z angz NewToilet.setangle y angy NewToilet.setangle x angx NewToilet.enable if home == 0 set Triger to movetoref.placeatme b3FlushTrigger else set Triger to movetoref.placeatme b3FlushTriggerHome set home to 0 endif Triger.disable if small == 1 Triger.setscale .4 set small to 0 else Triger.setscale .3 endif Triger.moveto NewToilet Triger.enable set Toilet to ArmorCombat set Toilet to getnextref goto 10endif set active to 4endifend