it's suppose to round the gold value in leaderstats to a whole number, but instead, if it's "2.8", it would turn into "2.7999999999999998224"
local function round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
game.Players.PlayerAdded:Connect(function(plr)
while wait(1) do
local value = plr:WaitForChild("leaderstats").Gold.Value
if value%1 > 0 then
round(value)
end
end
end)

5 comments
Why do you have an inf loop in the player added event? This will create a new loop every time a player joins.
The rouding function works as expected.
^
not for me, I'll just use an IntValue instead I guess
You never use the value returned by round .....