But this thing is quite annoying.
How do I fix this?
I don’t want decimal numbers, I want a SurfaceGui slider that goes from 0 to 300, without decimals.
Example: https://gyazo.com/0b08430efa6af63db7abda9cf40e333c
local Number = script.Parent.Parent.Int
mouse = false
script.Parent.MouseButton1Down:Connect(function() mouse = true end)
script.Parent.MouseButton1Up:Connect(function() mouse = false end)
script.Parent.MouseLeave:Connect(function(x,y) mouse = false end)
script.Parent.MouseMoved:Connect(function(x,y) if mouse then
if 300-(((y-script.Parent.AbsolutePosition.Y)/2200)*300) > 2 then
script.Parent.Int.Value = 300-(((y-script.Parent.AbsolutePosition.Y)/2200)*300)
else
script.Parent.Int.Value = 0
end
script.Parent.Bar.Size = UDim2.new(1, 0, ((1-((y-script.Parent.AbsolutePosition.Y)/2200))), 0)
end
end)
script.Parent.Int.Changed:Connect(function()
script.Parent.Bar.Size = UDim2.new(1, 0, (script.Parent.Int.Value/2)/50, 0) Number.Text = script.Parent.Int.Value
end)
Regarding this question exactly, you can do it like this:
local function frac(number)
return number - math.floor(number)
end
if frac(number) < 0.5 then
print("The decimal is less than 0.5")
else
print("The decimal is greater than or equal to 0.5")
end