Im making a function that with a value i can set the maximum amont of level that an enchant can have, I had something
function EnchantLimiter( limit: number, enchant: text): set {_maximum} to {_limit} add 1 to {_maximum} loop all players: loop all items in loop-player's inventory: if loop-item is enchanted with {_enchant} > {_maximum}: enchant loop-item with {_enchant} {_limit}
and this in my loop
EnchantLimiter({MaxAqua_Affinity}, aqua affinity)
could someone reformat or directly have a new way of achieving this function