|
| 02 Sep 2013 08:32 AM |
a={player="yay","fart"}
how can i find the player? i did this
a:FindFirstChild(player)
but error:
15:31:04.519 - Workspace.Script:7: attempt to call method 'FindFirstChild' (a nil value) 15:31:04.520 - Script 'Workspace.Script', Line 7 15:31:04.521 - stack end
plz show me the proper way |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 02 Sep 2013 08:41 AM |
a = game.Players:FindFirstChild("Player")
if a then print(a) end
basically the first line find anything in game.Players that's called Player meaning their name would have to be "Player" for the if statement to fire. |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2013 08:43 AM |
no no you misunderstood! player is just variable. here i will change so you wont get confused.
asd = {player=true,random_variable_again=false} |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 02 Sep 2013 09:02 AM |
| a = game.Players:FindFirstChild(a.player) |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2013 09:05 AM |
| noooooooooooo guys!! im not looking for a player!!! im trying to find my table which i named player. |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2013 09:06 AM |
| if its in workspace then just game.workspace.player |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 02 Sep 2013 09:07 AM |
| No guys you don't understand, he wants to find a certain entry in a table. I'm not sure how to do that though, sorry. |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 02 Sep 2013 09:09 AM |
You want to find the key to a value?
In that case you have to loop through it like this
for i, v in pairs(a) do if v == "yay" then --in this spot i is equal to player end end |
|
|
| Report Abuse |
|
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
| |
|
| |
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 02 Sep 2013 09:19 AM |
asd = {player=true,random_variable_again=false}
print(asd.player) print(asd.random_variable_again)
I don't even know anymore... |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 02 Sep 2013 09:22 AM |
| What are you even trying to do? You don't make any sense. |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2013 09:26 AM |
when a player enters my game, it replaces the key value inside the table
rooms = {player1=false, player2=false}
for i,v in pairs (rooms) do if rooms[i]~= true then return end rooms[i]=true -- then change the key name or something return end |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
| |
|
|
| 02 Sep 2013 09:30 AM |
for each player who enters a area specially for them is made, now the position is according to:
local fixedPos={"0,0,0", "0,0,300", "0,0,600","0,0,900", "0,0,1200", "0,0,1500"}
and this is the room for each one via table;
local rooms={false, false, false, false, false, false}
now my problem is, after the player left the area needs to be removed and so does the table i made just for them so that when others enters a new table can be available for them |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2013 09:34 AM |
so it should look like this
asd={meSmashsta=true, false, false, false, false, false}
after leaving it should look like this
asd={false,false,false,false,false,false} -- back to normal |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 02 Sep 2013 09:37 AM |
Your doing it wrong.
If the first table looked like
asd={true,false,false,false,false,false}
you could do asd[1] = false |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2013 09:40 AM |
| i know, i cant explain anymore so ill just quit and handle this using myself |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
|
| 02 Sep 2013 09:41 AM |
t = {["Trioxide"] = true, ["Hello"] = true}
TRIOXIDE TRIOXIDE TRIOXIDE TRIOXIDE TRIOXIDE TRIOXIDE |
|
|
| Report Abuse |
|
|
|
| 02 Sep 2013 09:43 AM |
| btw i appreciate all the help, thx guys |
|
|
| Report Abuse |
|
|