|
| 17 Apr 2017 12:37 AM |
player.leaderstats.Level.Changed:connect(function() if --[[ code here ]] then local items = {player.leaderstats.Level.Value, player.leaderstats.Gold.Value} local key = "user-" .. player.userId datastore:SetAsync(key, items) end end)
R$5,090 |
|
|
| Report Abuse |
|
|
NilLogic
|
  |
| Joined: 08 Apr 2016 |
| Total Posts: 1369 |
|
|
| 17 Apr 2017 12:37 AM |
The link below should answer your question, I hope I helped you.
http://wiki.roblox.com/index.php/Finding_if_a_number_is_even_or_odd
I'm just a friendly bot, please dont hate. |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2017 12:45 AM |
I'm not good at math
R$5,090 |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Apr 2017 12:48 AM |
this is the code i use:
if numberIsEven(143) then print('This function isn't real') end |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 17 Apr 2017 12:50 AM |
number = 3
if math.floor((number+1)/2) == (number+1)/2 then print("Its odd!") end |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
| |
|
| |
|
|
| 17 Apr 2017 01:34 AM |
| @CrimsonSparkleTime I think you're asking for a more detailed explanation of how finding the parity of a number works, right? If so, basically all even numbers are divisible by ## ## #### ###### it by two, and if it's a whole number it's even, otherwise odd. What samy22 posted works really well. Altohugh, I don't understand why adding 1 would help. I doubt you need to do that. math.floor() rounds what's in the parentheses down to the lower whole number. If it is a whole number, it'll return without changes. So comparing a math.floor() function with the same equation not in math.floor() will show if the number is whole or not. local num = 3 if math.floor(num/2) ~= num/2 then print("ODD") end |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2017 01:37 AM |
^^ Sorry gotta repost because ROBLOX filtering is crap.
I think you're asking for a more detailed explanation of how finding the parity of a number works, right?
If so, basically all even numbers are divisible by 2. All you gotta do is just it by two, and if it's a whole number it's even, otherwise odd.
What samy22 posted works really well. Altohugh, I don't understand why adding 1 would help. I doubt you need to do that.
math.floor() rounds what's in the parentheses down to the lower whole number. If it is a whole number, it'll return without changes. So comparing a math.floor() function with the same equation not in math.floor() will show if the number is whole or not.
local num = 3 if math.floor(num/2) ~= num/2 then print("ODD") end |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2017 01:44 AM |
can't you just
if num%2 == 1 then print("odd") end
|
|
|
| Report Abuse |
|
|
|
| 17 Apr 2017 01:48 AM |
@Lord_Narwhal
Oh wow! I forgot all about that, and I actually used that excessively to find parity in one of my programs. |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
| |
|
|
| 17 Apr 2017 03:19 AM |
@Josh you do realize a bot beat you to it
|
|
|
| Report Abuse |
|
|