How to break a break and collect random coins

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rodell2020

Ok I created a brick

now when i am standing under it and jump up
1 to 5
each time I hit the brick (I.E enter the Area ) I get a random number of coins ( 1 to 10)
and makes a sound
on the 5 time the brick breaks (I.E dis-appears form the screen)

:bust_in_silhouette: Reply From: Inces

Block needs to have a variable referring to its durability.
Every time a collision occurs this variable goes down one number and script checks it :
on collision :
play sound
give random amount of money
if durability == 0:
durability -= 1