I believe I see a small mistake in your snippet. However, you may want to use my version of your script, which is, in fact, very similar, but uses a different method of changing the music volume in a way that may save RAM consumption in your level.
;Artificial Intelligence Script
;Header
desc = Throttle Music based on location of entity
;Triggers
;DECLARE VARIABLES
:state=0:state=1,dimlocalvar=level
;CLASSIFY DISTANCE
:state=1,plrdistfurther=2000:state=2,setvar=level 2
:state=1,plrdistwithin=1999,plrdistfurther=1750:state=3,setvar=level 3
:state=1,plrdistwithin=1749,plrdistfurther=1500:state=4,setvar=level 4
:state=1,plrdistwithin=1499,plrdistfurther=1250:state=5,setvar=level 5
:state=1,plrdistwithin=1249,plrdistfurther=1000:state=6,setvar=level 6
:state=1,plrdistwithin=999,plrdistfurther=750:state=7,setvar=level 7
:state=1,plrdistwithin=749,plrdistfurther=500:state=8,setvar=level 8
:state=1,plrdistwithin=499:state=9,setvar=level 9
;CHANGE MUSIC VOLUME
:state=2:musicvolume=20,state=10
:state=3:musicvolume=30,state=10
:state=4:musicvolume=40,state=10
:state=5:musicvolume=50,state=10
:state=6:musicvolume=60,state=10
:state=7:musicvolume=70,state=10
:state=8:musicvolume=80,state=10
:state=9:musicvolume=100,state=10
;DETECT CHANGE IN DISTANCE CLASSIFICATION
:state=10,varequal=level 2,plrdistwithin=1999:state=1
:state=10,varequal=level 3,plrdistwithin=1749:state=1
:state=10,varequal=level 3,plrdistfurther=2000:state=1
:state=10,varequal=level 4,plrdistwithin=1499:state=1
:state=10,varequal=level 3,plrdistfurther=1750:state=1
:state=10,varequal=level 5,plrdistwithin=1249:state=1
:state=10,varequal=level 3,plrdistfurther=1500:state=1
:state=10,varequal=level 6,plrdistwithin=999:state=1
:state=10,varequal=level 3,plrdistfurther=1250:state=1
:state=10,varequal=level 7,plrdistwithin=749:state=1
:state=10,varequal=level 3,plrdistfurther=1000:state=1
:state=10,varequal=level 8,plrdistwithin=499:state=1
:state=10,varequal=level 3,plrdistfurther=750:state=1
:state=10,varequal=level 9,plrdistfurther=500:state=1
;End of Script
I hope this helps,
Akanto