|
| 31 Jul 2014 03:43 AM |
local player = Game.Players.LocalPlayer local character = player.Character
if not character then character = player.CharacterAdded:wait() end
local humanoid = character.Humanoid
humanoid.HealthChanged:connect(function() print(humanoid.Health) end)
It Prints humanoid.Health as string. How do I turn that into a number value? |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 03:49 AM |
| Also, values are some pretty crazy decimals. How can I round it? |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 04:03 AM |
| If you're trying round it upwards then, you could try using math.ceil(). |
|
|
| Report Abuse |
|
|
DEVMAC101
|
  |
| Joined: 01 May 2013 |
| Total Posts: 856 |
|
|
| 31 Jul 2014 04:07 AM |
| print (math.floor(humanoid.Health)) |
|
|
| Report Abuse |
|
|
DEVMAC101
|
  |
| Joined: 01 May 2013 |
| Total Posts: 856 |
|
|
| 31 Jul 2014 04:08 AM |
| And if you would like to round to the nearest integer, it requires a long equation, but I can give you a link. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 04:16 AM |
"And if you would like to round to the nearest integer, it requires a long equation, but I can give you a link." wat print(math.floor(num+.5)) |
|
|
| Report Abuse |
|
|
DEVMAC101
|
  |
| Joined: 01 May 2013 |
| Total Posts: 856 |
|
|
| 31 Jul 2014 04:17 AM |
function round(num,range) return (((num%range)*2)+num)-((((num%range)*2)+num)%range) end
Ha. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 04:22 AM |
The hell is that? So inefficient. |
|
|
| Report Abuse |
|
|
DEVMAC101
|
  |
| Joined: 01 May 2013 |
| Total Posts: 856 |
|
| |
|
|
| 31 Jul 2014 04:23 AM |
idk why but I'm screwing up locals. idk how.
local e = tonumber(humanoid.Health) local x = math.floor(e) local y = tostring(alphaRnd)
local deltaOffset = (x*2) local echoOffset = (100 - x)*(2) local foxtrotOffset = -(100 - x)*(2) + (-4) |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 04:24 AM |
Offsets are replacing GUI offsets, but comes up blank?
05:22:32.540 - Offset cannot be assigned to |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 04:25 AM |
> print(round(3.1415,3.1415)) 3.1415 "if you would like to round to the nearest integer"
>print(math.floor(3.1415+.5)) 3 >print(math.floor(3.7+.5)) 4
Do you even know what an integer is? |
|
|
| Report Abuse |
|
|
DEVMAC101
|
  |
| Joined: 01 May 2013 |
| Total Posts: 856 |
|
|
| 31 Jul 2014 04:28 AM |
| Congratulations, you can round lol. Mine works fine. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 04:34 AM |
Orly? > print(round(3.144445,1)) 3 > print(round(3.7,1)) 5
What exactly is the second argument? |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 04:54 AM |
| Do explain your math behind this and what each argument should be. |
|
|
| Report Abuse |
|
|