Adding this becasue I searched for an example and couldn’t find one and took some experimenting to get right. Hopefully it helps someone else!
I have an activity where students get 30 attempts to submit a coordinate point on a table.
All of this goes in the CL for the button component.
To limit number of submits:
disabled: this.pressCount=30
To display the countdown on the button:
label: " (${numericValue("${30}-${this.pressCount}")} attempts left)"
Obviously change the "30"s to match how many attempts you want students to have.
I also changed the button color so it will turn red when they get close to running out of attempts:
style:
when this.pressCount >= 25 buttonStyles.red
otherwise buttonStyles.default