|
| 16 Aug 2014 11:01 AM |
| OK so i recently made a thread for my if statements, but i read that its because i need local scripts for local player to work properly, so can anyone tell me a way to take the players name and put it in a variable without local player? |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 16 Aug 2014 11:04 AM |
You say 'The player' but which player? if you want all players do this:
for i, v in pairs(game.Players:GetPlayers()) do --v is the player. end |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2014 11:11 AM |
| @above well you hit a button then it assigns your playername (your username) to a variable, but just the person clicking the button, not everyone |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 16 Aug 2014 11:13 AM |
script.Parent.ClickDetector.MouseClick:connect(function(player) --player is the player. end) |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2014 11:14 AM |
| can i use the player argument and assign it to a variable within the function but still make it available to other scripts? |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 16 Aug 2014 11:16 AM |
_G.player = player
then in another script just reference _G.player to get the player. |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2014 11:16 AM |
| sorry for more but is it player or player.Name for the username of the player |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2014 11:17 AM |
ok thanks a bunch, ive been stuck on this for like 4 days
|
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 16 Aug 2014 11:19 AM |
| player.Name is the username. |
|
|
| Report Abuse |
|
|