I think instead of "while", you meant to use "for each" items
But I'm not sure what you expect this event to do..
If you change the while with for each what it will do is set the boolean of all items that are on layer 2 and are of type ammo and are not used to used..
If the instance of items with uid = player.uid is on layer2, is of the type ammo and is not used it will set it's ammoleft to items.maxammo
what I don't get is how you use the ammo by setting it used..
It doesn't change anything else than it's boolean in this event.