Limiting Pitch Rotation on Object

I’m not to familiar with programming and would like to do this, what would the blueprint for this look like? Or should I post a separate question.