From the very beginning, Jordan Firstman had faith.

Club Kid, Firstman’s feature debut as writer-director-star, opens with a flashback to a simpler time, namely 2016. A group of friends pile into an Uber on the way to a party where, crucially, Rihanna hit “Sex With Me” plays on the aux. “[Producers] begged me to shoot alts, and I said, ‘No, I’m not doing it. We will get the song,’ ” remembers Firstman of filming the scene sans rights to the Anti hit, running the risk of losing the opening of his film.

The 34-year-old finished filming at the top of the year and started editing. By the time filmmakers learned that Club Kid would be debuting at the Cannes Film Festival in May, they still hadn’t heard from Rihanna. “There did come a time about three weeks ago, where they’re like, ‘What are we going to do?’ And I was like, ‘Just trust. It will work itself out. I know if Rihanna sees this, she’s gonna gag for it,’ ” says Firstman. “We got it to her, and she did.”

(How did Firstman get Club Kid to the superstar? “God and my publicist, which may be one in the same.”)

In the making of Club Kid, from filming on location in New York during real parties to shooting on film to serving as the writer-director-star, Firstman gave himself a difficult mandate for his first turn as a feature director. But all that faith paid off, and now the film is heading to Cannes for a premiere in the Un Certain Regard section as one of the festival’s most anticipated sales titles.