|
| 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 |
|
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
| |
|