A Texas teen nearly missed his opportunity to walk across a stage to get his diploma over his pair of pants. But the kindness of a stranger moments before the ceremony was set to begin saved the day.

Leroy Solis Jr. was at MacArthur High School graduation ceremony at Freeman Coliseum when the principal told him that he wasn't adhering to the graduation's dress code, MySanAntonio.com reported.

Solis was wearing jeans.

Minutes before the ceremony was to start, Solis said he ran into a man and his father and asked them what some would think, is a strange question: Could they switch pants - trading jeans for the man's slacks, MySanAntonio.com reported.

The unidentified man agreed to the swap, and quickly changed, with enough time for Solis to line up with his senior class.

One thing they didn’t have time for was to get the kind man’s name.

Solis' sister Rosemary De Los Santos told MySanAntonio.com that she isn't angry over the school's policy but that jeans were the only option her brother had since their father is on a fixed income.

"I am forever thankful to the family, had it not been for them my brother would have lost out on his special day," Santos told MySanAntonio.com.