Clamping using nodes

Is there a way to clamp how far the object will go like a boundary for the object using nodes
I am building a space shooter and I need help to create a (boundary) limit that the object can’t cross on both sides ie.5 and -5 on the X axis
Thanks in advance.

I did this by simply placing an invisible wall at the outer limits and have the ship have physics on it. no coding or nodes needed. Not sure if that will work for your project.