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 » Scripters
Home Search
 

Re: The question of the function

Previous Thread :: Next Thread 
PoopcornTV is not online. PoopcornTV
Joined: 23 Apr 2015
Total Posts: 10
06 Feb 2017 12:16 AM
ATTENTION !!! MANY GOOGLE TRANSLATION Take for example this function: function ############## print(p.Name) end game.Players.PlayerAdded:connect(PlayerAdded) What the "p" in the function? As a function realizes that the ### ## a player? And how to understand that embed other functions instead of "p"?
Report Abuse
PoopcornTV is not online. PoopcornTV
Joined: 23 Apr 2015
Total Posts: 10
06 Feb 2017 12:17 AM
function PLAYERADDED print(p.Name) end game.Players.PlayerAdded:connect(PlayerAdded)
Report Abuse
Majarite is not online. Majarite
Joined: 14 Jan 2017
Total Posts: 394
06 Feb 2017 12:20 AM
Hey. # ## just a parameter. You can rename it what you want. Functions take *arguments* and use *parameters*. This is an example of a function with a parameter: function test(note) print(note) end In this function, note is a PARAMETER. We can name note whatever we want to. test("Hello") Here we past test an ARGUMENT. An argument corresponds to a parameter. Note will become "Hello". Think of every instance of note being replaced with "Hello".
Report Abuse
PoopcornTV is not online. PoopcornTV
Joined: 23 Apr 2015
Total Posts: 10
06 Feb 2017 04:38 AM
Thanks for the answer. if I ask in the function argument playeradded * plr *, then I can deal with him as a player? for example plr.name and the like?
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
06 Feb 2017 04:57 AM
yes. you can call the parameter anything you want

game.Players.PlayerAdded:Connect(function(potato)
print(potato.Name)
end)


Report Abuse
Majarite is not online. Majarite
Joined: 14 Jan 2017
Total Posts: 394
06 Feb 2017 11:06 AM
Sorry for my terrible formatting, I didn't preview the post and it got filtered.


Report Abuse
Majarite is not online. Majarite
Joined: 14 Jan 2017
Total Posts: 394
06 Feb 2017 11:07 AM
But to add on to what Popcorn said and my previous post, it doesn't matter what you name the parameters, though they should really be names that make sense.

The order you pass the arguments do matter though.

The first argument will correspond to the first parameter, the second argument to the second parameter, and so on.


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
06 Feb 2017 11:34 AM
refer to the wiki before asking

http://wiki.roblox.com/index.php?title=API:Class/Players/PlayerAdded


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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