limit script

hello... i am having a problem, i am trying to make a limit position script for an object lets say sphere01.
i am creating an exposetm helper and select the sphere then i add a float script controller to the x position of the sphere
i create a variable and link the variable to the node exposetm. then i write this script:
if (variablename.localpositionx >= 100) then

i am trying to say that if the local position of the variable is bigger or equal to 100 then the variable stays in 100 so not to let the sphere to go further of 100 units
but it not works.
can someone helps