generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: check if value has more than two decimals

Previous Thread :: Next Thread 
freshhotel is not online. freshhotel
Joined: 12 Jun 2012
Total Posts: 827
14 Nov 2017 04:27 PM
??????????????????????????????????????????????????????????????????????????????????????????


Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
14 Nov 2017 04:38 PM
if str:match("(%.)%w*(%.)") then print("2+ decimals") end
Report Abuse
Y0_dude is not online. Y0_dude
Joined: 03 Aug 2016
Total Posts: 113
14 Nov 2017 04:53 PM
Simpler option:

if number % 0.01 != 1 then print"More than two decimals." end
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Nov 2017 04:55 PM
"0.01 != 1"


~= 0


Report Abuse
Y0_dude is not online. Y0_dude
Joined: 03 Aug 2016
Total Posts: 113
14 Nov 2017 04:57 PM
whoops my mind is all jumbled right now!
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
14 Nov 2017 05:52 PM
oh i thought he meant like 1.0.1

like 2 decimals
Report Abuse
Gryphunk is not online. Gryphunk
Joined: 24 Nov 2012
Total Posts: 1267
14 Nov 2017 06:20 PM
local val = 903.22
local sub = string.sub
local snum = sub(tostring(val),#tostring(math.floor(val)) + 1)
if #snum >= 3 then
print("yeet")
end


heccled by the master heccler again
Report Abuse
TheeDeathCaster is online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
14 Nov 2017 06:30 PM
local num = 9.999

local chk = tostring(num):find('.')
if chk and #tostring(num):sub(chk+1) > 2 then
print('More than two decimals in number')
end -- Didn't test :|
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image