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: How to add numbers so

Previous Thread :: Next Thread 
Rurith is not online. Rurith
Joined: 05 Jul 2011
Total Posts: 9218
23 Apr 2014 08:43 PM
So, I need to add numbers, so when I say then , I want a thingy that adds 1+ (tO Anything) Just need that code where it +'s 1
Report Abuse
Rurith is not online. Rurith
Joined: 05 Jul 2011
Total Posts: 9218
23 Apr 2014 08:48 PM
sdsdsdsdsd
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Apr 2014 08:48 PM
var = 1

print(var) >>1
var = var + 1
print(v) >>2
Report Abuse
Rurith is not online. Rurith
Joined: 05 Jul 2011
Total Posts: 9218
23 Apr 2014 09:22 PM
What does Var stand for?
Report Abuse
Imacheeseburger is not online. Imacheeseburger
Joined: 16 Jun 2011
Total Posts: 142
23 Apr 2014 09:24 PM
Dude, learn scripting... I think what you need is this:
function Add(n1,n2,n3,n4,n5)
return(n1+n2+n3+n4+n5)
end
Add(1+WhateverYour#Is)
Report Abuse
Imacheeseburger is not online. Imacheeseburger
Joined: 16 Jun 2011
Total Posts: 142
23 Apr 2014 09:24 PM
Dude, learn scripting... I think what you need is this:
function Add(n1,n2,n3,n4,n5)
return(n1+n2+n3+n4+n5)
end
Add(1+WhateverYour#Is)
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 Apr 2014 09:57 PM
^ You called the function wrong...
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
23 Apr 2014 10:21 PM
@ImaCheeseBurger
You did it wrong

local function Add(...)
local Addends={...}
local Sum=0
for i,v in pairs(Addends) do
Sum=Sum+v
end
return Sum
end

Don't tell other people to learn how to script when yours can only have 5 arguments.
Please don't take this offensively though.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
23 Apr 2014 11:08 PM
local function Add(...)
local Sum=...
for i=2,select("#",...) do
Sum=Sum+select(i,...)
end
return Sum
end

This function lets you add anything with an __add metamethod. You can give it Vector3s, Vector2s, regular numbers, etc.

Add(thing1,thing2,thing3)

This is equivalent to

thing1+thing2+thing3
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
23 Apr 2014 11:11 PM
lol'd
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