Help/ in love with someone who doesn’t feel the same

I need some advice or just emotional support at this time, I have no friends or family to turn to so here I am…

I fell in love with my friend. We spoke constantly, from the moment we woke up until we fell asleep. We’d talk about everything, past present and future wishes. I trust him like I’ve never trusted anyone else, we’ve told eachother things that only we know. No one’s ever made me feel the way he does. He sent me a song, “Walk through hell by Anson Seabra” and I’ve been listening to it constantly. He told me he was falling for me, and I told him the same. He told me there was a chance something could happen in the future but things are complicated, I told him I’d wait for him.

Shit happened and we stopped talking properly for a week or so, but recently started again. Two nights ago we met up, spent a couple hours just talking and flirting then things got heated and we had sex in his car. It felt so passionate, the way he was kissing me.. He took care of me and made me feel incredible. Fast forward to today, I told him I’m in love with him. He apologised and said we can only be friends, and that nothing will happen. He admitted that he is still in love with his ex that he split up with 2yrs ago, saying that he still talks to her in the hopes that she’ll get back with him. I felt like a dagger had been driven through my chest. I want to keep talking and I know we can remain friends, I just don’t know how to get over it. I feel like I’m holding onto hope because of what he said previously and how he treats me. I know he’s got commitment issues so I feel like maybe I’ve just scared him but there’s still hope for a future…. I just feel lost.