Custom Enchant help

Hello guys! I need your help please I wanted to make a custom enchantment that makes you heavier but gives you a resistance buff but only if you're on a certain Y level. Unfortunately I can't figure out how to make the gravity attribute only activate when I'm on that desired Y level. It activates all the time. Also I can't figure out how to make the resistance buff permanent as long as I'm on that Y level It's 4:00 AM in our country and my brain can't spew out any logic for this<:husk:1221078528448270346> <:husk:1221078528448270346> Thank you so much!
Continue to help post