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 » Scripting Helpers
Home Search
 

Re: Values

Previous Thread :: Next Thread 
BetaGrey361 is not online. BetaGrey361
Joined: 27 Jun 2014
Total Posts: 118
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
BetaGrey361 is not online. BetaGrey361
Joined: 27 Jun 2014
Total Posts: 118
31 Jul 2014 03:49 AM
Also, values are some pretty crazy decimals. How can I round it?
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
31 Jul 2014 04:03 AM
If you're trying round it upwards then, you could try using math.ceil().
Report Abuse
DEVMAC101 is not online. DEVMAC101
Joined: 01 May 2013
Total Posts: 856
31 Jul 2014 04:07 AM
print (math.floor(humanoid.Health))
Report Abuse
DEVMAC101 is not online. 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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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 is not online. 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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
31 Jul 2014 04:22 AM
The hell is that?
So inefficient.
Report Abuse
DEVMAC101 is not online. DEVMAC101
Joined: 01 May 2013
Total Posts: 856
31 Jul 2014 04:23 AM
Its called accuracy.
Report Abuse
BetaGrey361 is not online. BetaGrey361
Joined: 27 Jun 2014
Total Posts: 118
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
BetaGrey361 is not online. BetaGrey361
Joined: 27 Jun 2014
Total Posts: 118
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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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 is not online. DEVMAC101
Joined: 01 May 2013
Total Posts: 856
31 Jul 2014 04:28 AM
Congratulations, you can round lol. Mine works fine.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
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
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
31 Jul 2014 04:54 AM
Do explain your math behind this and what each argument should be.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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