Hello developers, I’m making a grid system and need to check if the position of an object on that grid is a multiple of 3 to verify that the object is on the grid properly.
Any help with this is massively appreciated as it is a crucial part of the system.
Thanks, MBroNetwork
Edit: I am very stuck, I have no idea how modulus works and can’t get it to stay as a multiple of 3, it keeps giving me false detections of off-grid objects.
Take the number and divide it by 3. Then take this new number and math.floor() it. Compare the number from math.floor() and the number from dividing by 3. If the two numbers are equal, then the number is a multiple of 3.
I’ll probably look into modulus as well as this approach.
Due to the way the grid system works currently, an exploiter can just put a piece off grid by calling FireServer to the event.
I just did a check and apparently the modulus operator doesn’t support floating-point numbers which an exploiter could specify in their FireServer event.
Should I just round the int directly and then use that parameter?
Thank you so much, the way that it was being wrote everywhere I looked kept returning the wrong value.
Thanks for clearing up the misinformation and now that I know how it works, I can finally get the grid fixed so that exploiters can’t place objects off of the grid by calling FireServer.