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: table question

Previous Thread :: Next Thread 
dave2011 is not online. dave2011
Joined: 02 Oct 2010
Total Posts: 10581
30 Sep 2012 03:32 PM
say i have this table:
people={"asd","lol"}

how would I make an if statement that checked if a.Name was one of the items in the people table?
so it would end up looking like this people thing (however you do it)
if a.Name=people then
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
30 Sep 2012 03:34 PM
for _,v in pairs(people) do
if Player.Name == v then
print("hai c:")
end
end

you will have to define Player yourself
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
30 Sep 2012 03:36 PM
@black

More efficient ;)

for i,v in pairs(people) do
print(Player.Name == v and "hai C:")
end
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
30 Sep 2012 03:37 PM
This is more efficient if you receive any lag.

for i=1, #people do
if player.Name==people[i] then
print("Hello World!")
end end
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
30 Sep 2012 03:38 PM
if arguments can be integrated into a print''?
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
30 Sep 2012 03:38 PM
@Drak, no miz's is way better.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
30 Sep 2012 03:38 PM
Nah, mine is the best.
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
30 Sep 2012 03:40 PM
I was told pairs() was inefficient.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
30 Sep 2012 03:56 PM
No. It's not.
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