Kendrick Lamar made a surprise appearance at Compton College on Saturday to address the graduating class of 2024. The 17-time Grammy winner shared an inspiring message as he spoke in front of the graduates in his hometown, Compton, Calif.

“I wanted to come out here just to tell y’all how much I appreciate y’all,” Lamar told the class of 2024, per People. “I’m proud of the city of Compton, I’m proud of Compton College, most importantly I’m proud of the graduates out here.”

Lamar, who graduated from Centennial High School in Compton, continued to rave about his hometown during the ceremony, KTLA reported.

“Seeing y’all out here, it is not only a representation of the world, but it’s a representation of me,” he said. “When I walk out in these cities, in these countries, I can be proud and say, ‘This is where I’m from.'”

The 36-year-old artist also encouraged the graduates to always believe in themselves.

“Some people tell us, ‘This generation, they don’t have what it takes, Gen Z,'” he said. “We talk about it all day. They try to pull us down and say we don’t know what we’re doing. They wrong, though. You know why, because not only y’all have what it takes, but y’all have something even bigger. Y’all have the heart, y’all have the courage to be independent thinkers.”

Lamar has told his own story about growing up in Compton multiple times throughout his career, sharing his thoughts in his music and in interviews with the media. In an interview with RollingStone, the California native spoke about the violence he witnessed while growing up. Lamar revealed that he was 5 years old when he witnessed a teenage drug dealer getting shot down near his house. He also said he witnessed another murder at 8-years-old at a drive-thru.

Speaking with Saturday’s graduating class, Lamar made it clear to the students that he understands the challenges they face in Compton and he understands what it takes to overcome obstacles.

“You had a lot of hardship, not only in your house, in your communities, but most importantly, within yourself, and that’s the toughest thing to overcome,” he said. “We still growing day by day, brick by brick, making sure that we develop, not only in physical form but in the spiritual as well.”

Although there may be more challenges for the students in the future, Lamar advised them to have faith.

“Now it’s all about taking these resources and taking what you learned and applying. It’s as simple as that,” he said. “You’ll have hardships, you gonna have tribulations as you had coming up here, but guess what? You have someone special in your corner and all around you and that’s God, period. Every step of the way.”

Lamar gave his fans yet another hit track in May when he released “Not Like Us,” a diss track against Drake. The song debuted at No. 1 on the Billboard Hot 100.