local a = script.Parent for i=1, 10 do a.Transparency = a.Transparency+0.1 wait(0.2) end print("The transparency of the brick is " .. tostring(a.Transparency))
Output: The transparency of the brick is 1.0000001192093
Is it possible to tell the computer to round the value rather than have all these significant figures?
Using math.floor()
you can round Down whatever you wish to inside the parenthesis.
There is a simple method to allow it to round to the nearest whole number though. Simply add .5 to whatever you wish to round up within the math.floor
method.
Example:
print(math.floor(2.2 + .5)) -- This should print 2 print(math.floor(2.8 + .5)) -- This should print 3
Using your script:
local a = script.Parent for i=1, 10 do a.Transparency = a.Transparency+0.1 wait(0.2) end print("The transparency of the brick is " .. tostring(math.floor(a.Transparency + .5)))
Let me know if you have any other questions!
Resources: