math
...lol
On Buy max button clicked
--Add to "baby chick" floor(eggs/10) (eggs divided by price)
--Subtract from "eggs" floor(eggs/10)*10
Or (if they are sprites not variables)
On Buy max button clicked
-Repeat floor(eggs/10) times
--Create chick
--Subtract 10 from eggs
Floor() simply rounds down. So if you had 95 eggs, floor(eggs/10) would result in 9 (9.5 rounded down)
Edit: Whoops, had some stuff backwards