I wouldn’t suggest following any reply given about something so small. Performance on arithmetic operations, such as dividing or multiplying, are extremely fast.
-- Dividing
local Variable = 1
local DebugTime = os.clock()
for _ = 1, 10000 do
Variable /= 10
end
print(os.clock() - DebugTime)
--Time taken: 0.00007559999357908964s
-- Multiplying
local Variable = 1
local DebugTime = os.clock()
for _ = 1, 10000 do
Variable *= 0.1
end
print(os.clock() - DebugTime)
-- Time taken: 0.00005400000372901559s
The reply by @TestAccount563344 is somewhat misleading, because their output shows 4.00003… and so on, making it look bigger than it really is. Based on my performance script above, if you were to divide or multiply 1,000,000 times in one frame, it still wouldn’t cause lag, no matter the option you chose.
For reference on how little this matters, your code should only be running 60 times in one frame. The performance measured in seconds has so many decimals because of how small it is that Roblox has to use e
to signal that it has more decimal places than it would like to count.
Also, if this code is running in a local script, it doesn’t matter if 10 people are playing or 10,000, because the code is only being ran on one client each.
To sum this all up, us whatever you want and what makes most sense for you to use. Optimize your code for big functions, like hitboxes, or plot building tools, etc. Optimizing something this negligible is considered micro-optimizations and it hurts your development workflow if you continue on this path.