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: I need help understanding...

Previous Thread :: Next Thread 
magicalandre13 is not online. magicalandre13
Joined: 21 Jan 2011
Total Posts: 5327
12 Oct 2013 07:47 PM
1. Child in pairs

2. functions (especially the part after like 'function(whatgoeshere)'

3. ..playername and how do i give a message to a particular person

4. parenthesis (where to put them)
Report Abuse
magicalandre13 is not online. magicalandre13
Joined: 21 Jan 2011
Total Posts: 5327
12 Oct 2013 07:50 PM
b1.
Report Abuse
magicalandre13 is not online. magicalandre13
Joined: 21 Jan 2011
Total Posts: 5327
12 Oct 2013 07:51 PM
for the parenthesis part i need help on like


onplayerjoined))()(()()()()()( -- <-- craziness here

and i need to understand this onplayerjoined.

another parenthesis example would be like

end)
end)
Report Abuse
magicalandre13 is not online. magicalandre13
Joined: 21 Jan 2011
Total Posts: 5327
12 Oct 2013 07:52 PM
b2.
Report Abuse
magicalandre13 is not online. magicalandre13
Joined: 21 Jan 2011
Total Posts: 5327
12 Oct 2013 07:54 PM
umg.

u guys all hate me or somethin

):
Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
12 Oct 2013 07:56 PM
Functions all have parantheses, and you can put arguments in them (but you don't have to.)

Functions basically work like this:

function functioname(arguments)
end
-- The word 'function' to show we're making a function, the name of the function, and any arguments inside them, and 'end' to close the function.

Example of a function with no arguments:

local a = 2

function printA()
print(a) -- Gonna put whatever a is in the output
end

printA() -- calling the function, always use parantheses when calling it

-- Output shows 2

Example of one WITH arguments:

local a = 2

function printNum(num)
print(num) -- prints whatever num is, which we decide later
end

printNum(a) -- Calling the function using 'a' in place of 'num'
Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
12 Oct 2013 07:59 PM
Also, most functions won't have parantheses at the end unless:

- You connect the function in the same line you make it (also called anonymous functions)
- You put it inside a coroutine
- You just feel like putting them there


For example, instead of:

function printName(hit) -- Function here
print(hit.Name)
end

game.Workspace.Brick.Touched:connect(printName) -- Connection here

We do this:

game.Workspace.Brick.Touched:connect(function(hit) -- Connection AND Function
print(hit.Name)
end)
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
12 Oct 2013 08:01 PM
1. Child in pairs

That is used to do a specific function to every member in a table

The table goes in for i,v in pairs(table) do
--v is the child
end

2. functions (especially the part after like 'function(whatgoeshere)'

Functions are used for various reasons. They are mostly used for Events, Organization, and Cleanliness. You write a function like:
function hi()

The paranthesis are the parameters for the function. It is useful for if you want to perform the same function on different things with having to make a whole function. Example:
funtion Hi(text)--Creating the function
print(text)
end
Hi("assasds")--Calling the function with the text inside.
You can also connect a function to an event. An event is basically when something happens to something else. In the object browser there is a bunch of events

3. ..playername and how do i give a message to a particular person

Idk what you mean by playername but to give a message to a particular function you put the Message in PlayerGui

4. parenthesis (where to put them)

Parenthesis should only be put for methods, connect lines, math strings and stuff like that, and functions. Atleast thats all I know... Anyway when people put end) on stuff they are usually connect a function that hasn't been created to an event, so they are making the function inside the connecting line. So say part.Touched:connect( function()--Creating a function without a name

Your crap
end--ending the function and closing the connection line.
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
12 Oct 2013 08:05 PM
I'm writing a bit of a wall of text atm, I'll post it soonish.
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
12 Oct 2013 08:07 PM
Actually, I'll PM you it.
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