Help with changes an image with a script

i just decided not to animate a coin flipping since it was taking so much time so ill give you solution for writing that huge answer