Are you sure max ain’t smaller than min?
The function should be written like this?
math.clamp (number x, number min, number max)
2 Likes
You’re right! That did solve the issue, and I did pretty much never use math.clamp
so I appreciate you posting an additional solution.
2 Likes
Makes quick work of if statements in this aspect.
1 Like
Thank you both. It generally only started as a question, but I learnt something new from it and it is much better than having that long if statement. That math.clamp is powerful.
I’ve now modified my game using the methods you guys have showed me.
1 Like