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 » Scripting Helpers
Home Search
 

Re: help! a={player="yay","fart"}

Previous Thread :: Next Thread 
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
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 is not online. 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
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
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 is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
02 Sep 2013 09:02 AM
a = game.Players:FindFirstChild(a.player)
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
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
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
02 Sep 2013 09:06 AM
if its in workspace then just game.workspace.player
Report Abuse
Kodran is not online. 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 is not online. 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 is not online. mic144
Joined: 14 Oct 2009
Total Posts: 1598
02 Sep 2013 09:13 AM
asd['yay']
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
02 Sep 2013 09:17 AM
none worked so far
Report Abuse
Desperian is not online. 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 is not online. 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
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
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 is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
02 Sep 2013 09:28 AM
It still makes no sense.
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
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
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
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 is not online. 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
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
02 Sep 2013 09:40 AM
i know, i cant explain anymore so ill just quit and handle this using myself
Report Abuse
Trioxide is not online. 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
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
02 Sep 2013 09:43 AM
btw i appreciate all the help, thx guys
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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