There are many different paths to success in Hollywood, and many where the truth of those journeys is considerably stranger than fiction. But even for an industry with an indefatigable aptitude for self-mythologizing, it seems hard to believe that one of the biggest directors in the world made his breakthrough with a comedy produced, written by — and crucially, starring — a gangsta rapper so incendiary that he called himself “the n—a that you love to hate.” But 24 years later, “Friday” helmer F. Gary Gray, who subsequently set box office records with “Straight Outta Compton” and “The Fate of the Furious,” is set to receive a star May 28 on the Hollywood Walk of Fame, just weeks before the release of his latest megabudget franchise film, “Men in Black: International.”

Taking a short break from editing “Men in Black,” due out June 14, Gray says he gets anxious even now reflecting on the prospect of casting Ice Cube in his directorial debut.

“That was one of the scariest moments in my entire career, to this day,” he tells Variety. “To take the scariest artist on planet Earth and make him the straight guy in a comedy? That’s career suicide before you even have a career.”

It was Cube who reassured him that their gamble would pay off, but not before he was convinced that his dream of following in Steven Spielberg’s footsteps would come to an end before it even began.

“He would have to encourage me to put him in situations and reassure me that it’s OK, because initially I didn’t see him like that — and if [audiences] don’t, that Spielberg dream’s out the window,” he says. “I wish I could say this was something that we really sat down and studied comedies and we knew that this formula would work, but it was a total Hail Mary. I’m happy to this day that people feel like it really worked, but it was definitely a roll of the dice.”

Unlike many of his 1990s peers, Gray didn’t get into directing as a child of the VHS generation who grew up watching movies, absorbing their filmmaking lessons and fantasizing about telling his own stories. There were early moviegoing experiences that, he says, were formative, but it was moving from Inglewood, Calif., to Highland Park, Ill., that helped lock in his artistic ambitions.

“I loved ‘Star Wars,’ but I can’t tell you that made me want to make movies,” Gray says. “If you watch that when you’re a kid, it’s just magic at that point — and I didn’t fancy myself a magician at that age. But my uncle was an actor for the Inglewood Playhouse in what was Centinela Park [renamed Edward Vincent Park now], and he convinced me and my younger brother to go to a play where we got a chance to see people performing and behind the scenes and all of the technical stuff.

“It sparked my interest in entertainment, and then I moved to the suburbs of Illinois in Highland Park, which I compare to going from a Hughes brothers movie like ‘Menace II Society’ to a John Hughes movie like ‘Breakfast Club,’ And I loved them both, because I’ve been able to draw from both experiences and put them on the screen.”

Inspired by a social studies teacher to emulate a successful person in whatever field he wanted to pursue, Gray chose Spielberg. But the budding filmmaker’s down-to-earth sense of practicality (and Spielberg’s facial hair) prompted him to set a deadline that he would eventually beat by almost 20 years.

“I said by the time I’m 45 I’ll make a movie, because when you’re a teenager, you think 45 is old,” he says, laughing. “I think Steven Spielberg had a beard, so I was like, ‘I’ll emulate that guy.’ And it’s funny because I spoke to Spielberg a couple of weeks ago, and we laughed about how long it took for our beards to connect.

“It really started with watching him and looking at how skillful he is at doing movies from different genres. I definitely emulated that, so to be able to talk to him and to work with him, albeit somewhat indirectly on ‘Men in Black,’ was a great reminder how life can kind of come full circle.”

Without the resources to attend film school, Gray found his first directing jobs on the small screen tackling music videos for WC and the Maad Circle, and later, with Ice Cube on what became one of the rapper’s signature songs, “It Was a Good Day.”

“Music videos were an extension of my learning,” he says. “It was less about storytelling and more about the ability to work with a crew and to move a team of people around the city, and to be efficient.”

But even as he edged closer to the industry he wanted to be a part of, his heroes unexpectedly changed from the practical to the more broadly inspirational. “Especially in the beginning, I actually wouldn’t say, ‘What would Spielberg do?’ I would think about sports figures like Muhammad Ali,” Gray says. “I would watch how people would say it’s impossible for him to achieve the things that he set out to achieve, and he did it anyway under extreme pressure with extreme obstacles in the context of a time where there’s a lot of resistance and push back.”

Gray adds, “Coming up in the ’90s, there were a lot of stories about USC and NYU film schools, and people would say, if you’re going to be successful in this industry, that is a must. So these documentaries on Muhammad Ali got me through those moments where I felt discouraged but didn’t give up.”

The back-to-back success of “Friday,” the women-driven heist film “Set It Off” and the Kevin Spacey-Samuel L. Jackson thriller “The Negotiator” established Gray as a skillful and versatile technician who refused to be locked into making one type of film. “I’m at least trying not to kind of just loiter in a specific genre,” he says.

But as the logistics of his films grew more enormous and their stories more ambitious, Gray notes that his north star for choosing projects was not simply the opportunity to do something new or different but a common and intuitive connection that he shared with each of them.

“There has to be some something; rather it’s a theme that serves kind of who I am, or serves a value that’s important to me.

“Directing is a hard job if you don’t have some sort of emotional connection to the material,” he says. “It’s a major challenge when you’re dealing with talent on a high level, you’re traveling around the world and you’re dealing with politics and budgets and studio executives and things like that. What gets you through these processes are the things that connected you from the beginning — so there has to be a hook.”

In 2015, Gray broke box office records with “Straight Outta Compton,” a chronicle of the rap group N.W.A that reunited him with Ice Cube, and then followed its success with “The Fate of the Furious,” which until “Avengers: Infinity War” had the highest global opening of all time. Though he’s proud of these accomplishments, Gray says he doesn’t dwell on them too much — except to be grateful that they’ve allowed him greater freedom to tell the stories that he wants. “I’ve said from the beginning that I’m just competing with myself. Box office is a byproduct of a lot of things, and at any given time, those things can change. I’m happy for Jordan Peele or Ryan Coogler or Ava DuVernay to take the torch and do what they’re doing. If I were looking to compete, then I would be someone in this opposition position, and that’s not where my head is at all. So I just focus on what I create and if along the way I blaze a trail or two, that’s fantastic.”

He admits that trail hasn’t always been a smooth one. “I’ve had a chance to surf a few genres, some successfully and some maybe not so successfully.” But in the absence of a more recognizable guidebook, the biggest lessons he’s learned were decidedly more personal than professional.

“When you’re younger, there’s ego involved, you barely know what you’re doing, and you walk in with your chest out thinking, I’m supposed to have all of the answers. But when you start to add some years to your resume and more experiences, you start to grow personally. I think I’m more patient, definitely more calm, and I have faith in the process no matter how hard it gets — and that just comes with time.”

As a filmmaker who repeatedly changes directions with his subject matter, Gray says he still hasn’t made his “Citizen Kane,” although he suggests “Straight Outta Compton” came close. But even if his body of work doesn’t seem as outwardly personal as those of his colleagues and contemporaries, the 49-year-old director remains as hungry and clear-eyed as ever to transport and move audiences.

“I’m inspired by material that puts energy into bringing people together,” he says. “I think if you can in a subtle, smart way, have a thread of meaning in your films, like ‘It’s a Wonderful Life’ or ‘Life Is Beautiful,’ where you find yourself just slightly changed after you experience a film like that, that’s the holy grail for me.”

So Gray’s story is far from finished, and not just because he has a Walk of Fame ceremony to look forward to on May 28, much less another highly anticipated summer blockbuster on the horizon with “Men in Black: International.”

“I feel like the next chapter is going to be weird in a good way, and it’s going to be creative,” he says. “I feel fortunate that I’ve had success in a lot of different realms. I feel more whole than this 20-year-old kid who was running around screaming ‘I can do the impossible.’ This business has afforded me the ability to do that. And that’s one of the things I appreciate the most. And all of the movies up to this point have given me the ability to do what I’m about to do next.”

What: F. Gary Gray receives a star on the Walk of Fame.
When: 11:30 a.m. May 28
Where: 6426 Hollywood Blvd.
Web: http://www.walkoffame.com