help with coin op Project

but still no joy am i anyway right

The code you posted does something. You expect it to do something. I'm guessing that "no joy" means that what the code does is not what you expect.

You need to tell us what the code actually does, and how that differs from what you want.

const int coinMecPin = 2; //the number of the coin mec pin
const int relayPin = 7; //the number of the relay pin

Do those comments really add any value?

 buttonState = digitalRead(coinMecPin); // read the state of the pushbutton value:

Why would you store the state of the coin mechanism pin in a variable called buttonState? You didn't sew a button onto the Arduino, did you?

   if(gotCoin());

Can; you; find; another; example; of; an; if; statement; that; ends; with; a; semi-colon;, where; the; semi-colon; actually; belongs; there;?