Is there any possible ways to shorten a lot of comparsion like if x > y and x > z and x > a

Hello. Can someone please tell me, is there any possible way to shorten comparsion in situations where I need check 1 variable many times, like in this situation?

if X > Y and X >= Z and X < A and X <= B then

There’s typically no way to shorten things like this. Since they’re all comparisons of different variables, which I assume don’t have any direct linkage between, then you’re stuck with comparing each one individually.

2 Likes

Yeah I suggest you just copy and paste it where you need it.

I mean you could probably find a way to not need to compare all of those values (just assuming) but I personally think it isn’t that tedious but yeah you should probably just copy and paste it when you need to.

If that specific code is needed a lot in your script, you can make it into a function to make it easier

I personally changed my keyboard layout and made the numpad numbers be those symbols and I also made it work only inside of Roblox Studio:

NP1 = >
NP2 = <
NP3 = =



iAmDany (@Danielhoteaale)

If this solved your issue, marking this as the solution helps out a ton!
1 Like