How do I show him I care about him same time let him know I can walk away?

I have a boyfriend and like he is literally taking me for granted and like he doesn't care or give me attention like it should be, I talked to him about it and he always act as nth is wrong and I get the blame of not caring and not giving him attention
How do I do it correctly, how make him understand that i actually can walk away for real, not only by talking
How do I show him I care about him same time let him know I can walk away?
Post Opinion