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
 

Tables

Previous Thread :: Next Thread 
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
28 Sep 2014 06:30 PM
How do I loop through a table while trying to use an if on each variable "v"

tab = {"Name,"Name","Name"}

function onPlayerEntered(plr)
so like for i,v in pairs do
--loop through table
end
if plr.Name == v.Name then
--stuff
end

game.Players.PlayerAdded:connect(onPlayerEntered)

Mind showing me how I would set this up correctly?
Report Abuse
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
28 Sep 2014 06:38 PM
Bump
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
28 Sep 2014 06:42 PM
tab = {"Name,"Name","Name"}

function onPlayerEntered(plr)
for i,v in pairs(tab) do
if plr.Name == v.Name then
--stuff
end end

--Connection line here.

You mean like this?
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
28 Sep 2014 06:43 PM
Don't use v.Name just use v

if plr.Name == v then
Report Abuse
opplo is not online. opplo
Joined: 09 Dec 2008
Total Posts: 5320
28 Sep 2014 06:44 PM
tab[v]
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