|
| 18 Apr 2016 05:21 PM |
| How do you round a value (number value)? |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 05:26 PM |
math.ceil, rounds up to the nearest whole number. e.g. math.ceil(3.3) = 4 math.floor, rounds down to the nearest whole number. e.g. math.floor (3.3) = 3 This may come in handy; http://wiki.roblox.com/index.php?title=Function_dump/Mathematical_functions
|
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 05:31 PM |
while true do if script.Parent.Parent.TorF.Disabled == true then script.Parent.Text = math.floor(script.Parent.Parent.Upg1Worker.Value.Value) script.Parent.Parent.TorF.Disabled = false wait() wait() end wait() wait() end
DOESNT WORK |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 05:34 PM |
-- Try this script.Parent.Text = tostring(math.floor(script.Parent.Parent.Upg1Worker.Value.Value))
|
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Apr 2016 05:38 PM |
Add a print("Checker") under the line I gave you to make sure it is actually running.
|
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 05:41 PM |
well it did print it its just not showing the number on the text. the script for the Upg1WOrker is
script.Parent.MouseButton1Click:connect(function() if game.Workspace.cocl.SurfaceGui.TextButton.Value.Value >= 10 then script.Parent.Parent.Upg1Worker.Disabled = false script.Parent.Parent.TextButton.Value.Value = script.Parent.Parent.TextButton.Value.Value - 10 script.Parent.Parent.Upg1Worker.Value.Value = script.Parent.Parent.Upg1Worker.Value.Value + 0.3 script.Parent.Parent.TorF.Disabled = true end end) |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 05:42 PM |
| I ment not the upg1worker the upg1script |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 05:44 PM |
--Change the print to print(script.Parent.Text) -- Make sure this is after script.Parent.Text = math.floor(script.Parent.Parent.Upg1Worker.Value.Value)
|
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 05:46 PM |
| wait I didnt have to round this whole time. |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 18 Apr 2016 06:28 PM |
I mean if you could write down the output or something..
Anyways that wont work if your game is filtering enabled and that is a localscript (which in this case should be cuz its a gui script)
-Salinas con el número 23 |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 06:28 PM |
^ Mhm. I don't think however he is using FilteringEnabled.
|
|
|
| Report Abuse |
|
|
|
| 18 Apr 2016 06:31 PM |
function round(num) local decimal = num - math.floor(num); if(decimal >= .5) then return math.ceil(num); else return math.floor(num); end end |
|
|
| Report Abuse |
|
|