|
| 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 |
|
|
|
| 06 Feb 2017 12:17 AM |
| function PLAYERADDED print(p.Name) end game.Players.PlayerAdded:connect(PlayerAdded) |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|