Easiest way would be a branch node. Check whether the distance is greater than your variable, and if it is, set it to equal to the current distance, if not, do nothing.

I have a variable that tracks distance.

How can I clamp it when the distance reaches a max value that is achieved by the distance variable?

Then unclamp it when the distance reaches that same achieved distance variable?

i.e. if variable reaches max distance value of 122 clamp it so when distance is < 122 the value 122 doesn’t change

when variable reaches 122 keep it clamped if value doesn’t rise above 122 but if it does, keep updating the variable. Then when the distance goes down keep it at its newly max value w/ a clamp

How can I accomplish this with these nodes? My variable updates on EventTick

I don’t know how to set the max and min values since my variable score (which is z distance) updates every tick and is the only variable representing that specific distance. Since the max/min will always update and set to the variable, I cannot just type in a max or min value for that will not suffice to what the variable will set to.

Okay, there’s a few problems with that. First, you’re finding the difference between two vectors, the two actor locations, then taking just the z value and converting that to a vector and finding the length of that converted vector.

Why convert from z to a vector? That will just take the value given to it, and create a vector where x, y, & z = the value you fed it. Then finding the length of this will just give you back the original value. If you just want to calculate distance in z, you can skip all that and just compare the z values.

Anyway, here’s an example of how I would suggest doing it if that’s what you’re after.