Hazor
|
  |
| Joined: 09 Feb 2009 |
| Total Posts: 5804 |
|
|
| 03 Sep 2011 11:02 PM |
| How exactly do you add a variable into a player when they enter the game? Just a question... I am going to need to do it for a project I am working on. |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 03 Sep 2011 11:04 PM |
game.Players.PlayerAdded:connect(function(Player) --Statements end)
Player would be the variable for the new player or you could always just use a local script. |
|
|
| Report Abuse |
|
|
Hazor
|
  |
| Joined: 09 Feb 2009 |
| Total Posts: 5804 |
|
|
| 03 Sep 2011 11:06 PM |
| Well... uh, the Variable part was what I was looking for... |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 03 Sep 2011 11:07 PM |
| Then change Player to Part. . . |
|
|
| Report Abuse |
|
|
Hazor
|
  |
| Joined: 09 Feb 2009 |
| Total Posts: 5804 |
|
|
| 03 Sep 2011 11:10 PM |
No, I mean, how do you add the variable? Is it:
"Insert.variable" or did I get that wrong?? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 03 Sep 2011 11:10 PM |
A variable is a number value.
You mean Insert.table, or leaderstats?
<'+1 Post. Ujelly?'> IT'S A PEAR http://www.roblox.com/Pear-Hat-item?id=60907280 |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2011 11:11 PM |
What do you mean by variable? Can you explain?
What I think: SavedPlayers = {}
game.Players.PlayerAdded:connect(function(Player) table.insert(SavedPlayers,Player) end) |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 03 Sep 2011 11:11 PM |
game.Players.PlayerAdded:connect(function(Player)
Thats the connection line
the argument inside the parentheses after function is the variable? I don't get it if you mean something else |
|
|
| Report Abuse |
|
|
Hazor
|
  |
| Joined: 09 Feb 2009 |
| Total Posts: 5804 |
|
|
| 03 Sep 2011 11:15 PM |
Ok, by variable, I mean a number variable that I can use in different scripts.
For example, a lava brick may or may not kill a person steping on it, depending on the current value of the Variable. What I don't know is, how do I make a script that adds said variable into the character or humanoid inthe first place... |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
| |
|
|
| 03 Sep 2011 11:18 PM |
Oh, is that so. Use _G or something similar, Global.
game.Players.PlayerAdded:connect(function(Player) _G[Player.Name] = Player end) |
|
|
| Report Abuse |
|
|
Hazor
|
  |
| Joined: 09 Feb 2009 |
| Total Posts: 5804 |
|
| |
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 03 Sep 2011 11:20 PM |
Just checked the wiki on it.
They changed it to shared? I never used it so I never payed attention. |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2011 11:21 PM |
Yes, Global. Which what all script can access.
table.insert <--Function from _G math.random <--Function from _G Insert <--Table from _G string <--Table from _G |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2011 11:21 PM |
| There are two, _G and shared. Both are the same. |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 03 Sep 2011 11:22 PM |
You use _G to index global variables.
|
|
|
| Report Abuse |
|
|