So I have this problem where the taken away number returns unrounded.
local left = cooldowns[ability]
repeat
task.wait(0.1)
left -= (0.1)
gui.Frame:FindFirstChild(ability..'_text').Text = left
until left <= 0
I need the . la lala to still be there, I tried searching on how to fix it but coulden’t find anything useful.
4 Likes
There are loads of post on how to round numbers to 1 or 2 d.p
2 Likes
I have not found one with a fix with what IM working with, and im working with decimals not whole numbers.
2 Likes
You wanted the number to be x.x correct?
2 Likes
Yes. And either i’m bad at searching or my computer is not showing the correct posts when searching.
1 Like
If I understand correctly you could use math.round(number).
local number = 3.2
print(math.round(number)) --> it will print out 3 in this case.
2 Likes
Yes but no, i need the decimals to be there, but i dont want the extra decimals.
2 Likes
I was searching for “Value returning 0.1000001 instead of 0.1, roblox”
2 Likes
That only happens because of some weird computer thing due to binary or something like that
2 Likes
Thanks for helping tho man!
This has not happened before on roblox but it started to occur a long time ago.
2 Likes
Scottifly
(Scottifly)
#12
It’s called floating point error. Happens when converting from binary to base 10 decimals.
3 Likes
system
(system)
Closed
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.