You say you were given the rifle, I'm assuming that a parent or similar bought it brand new and gave it to you direct?
If that's the case, then it might help to take the actual purchaser along to have a word.
Under the sale of goods act, they have to provide a product that is "substantially as described, of reasonable quality and fit for purpose"
Your rifle fails two of those tests, possibly all three, as I'm sure he didn't describe it as "not working".
You have the right to demand a replacement or refund. He can offer to try and fix the problem, and you can choose to accept,