Problem with clamp (SOLVED)

Greetings, just a small one this time

I’m doing a test to limit the size of a balloon. I have a progress bar that showcases the size.

I want to clamp the values between 0 and 100. While the balloon’s size DOES stay clamped, the value does not…

Now I do have limiter variables, and they do work, but I feel like clamping would be a better practice here:

Where do I put clamp if I want to clamp the value?

1 Like

Why would the clamp you are setting directly on the object scale impact a separate variable that isn’t clamped at all?

Edit: if you are wanting to clamp the variable itself, you will have to clamp the variable in every action that modifies the variable. Alternatively, you could just use a “compare two numbers” condition and put the clamp over the side with the variable on it

Like this? I tried and it’s not working. Is there something I missed?

No, you want to set the variable balloonsize as:

Up key pressed → “balloonsize = clamp(balloonsize + 1 + TimeDelta(), 0, 100)
Down key pressed → “balloonsize = clamp(balloonsize - (1 + TimeDelta()), 0, 100)

2 Likes

I see, I’ve been applying it incorrectly, thanks!