Rounding up to nearest .1 not working

I’ve tried multiple methods but none are working, it keeps adding like a million 0’s, and then even when it does seem like its working it goes to a .09 or something.

RunService.Heartbeat:Connect(function()
	local value = Values.Movement.JumpPower.Value
	
	for i = 1,3 do
		value *= 10
	end
	
	math.floor(value)
	
	for i = 1,3 do
		value /= 10
	end
	
	script.Parent.Text = value
end)
RunService.Heartbeat:Connect(function()
	local value = Values.Movement.JumpPower.Value
	
	value *= 100
	
	math.floor(value)
	
	value = value / 100
	
	script.Parent.Text = value
end)
3 Likes
script.Parent.Text = string.format("%.1f", value)

The %.1f means “print this as a floating point decimal with 1 digit of precision.”

Consequentially, you probably don’t need the math.floor either.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.