Loop certain number of times then do action

The problem was the code not the relay, so I can't see how a different relay would help