For Loops, players and the whole nine yards

All in all I’m just having some trouble understanding exactly how for loops work, and what kind of syntax’ I would use for certain types of operations.

For one, I want to get all the players with a loop and then do things if they apply to the if statement:
[lua]function ForLoopPly( pl )
for _, pl in pairs(player.GetAll()) do
if(pl:IsUserGroup(“lolgroup”)) then
else return end
An example, not actually doing anything here just asking if that would work. I still don’t understand the difference between for k, pl in pairs and for _, pl.

Also on another note, what are the main differences between local functions and plain old functions?

Thanks for any help provided,

i was confused also when i started messing with ‘for’ but soon found out that [lua]for lulz, wut in pairs(table)[/lua] is the same as [lua]for k, v in pairs(table)[/lua] or anything else. the k, v or whatever can be any variable all its doing is assigning the key to the first var. and the value to the second of that table.

local functions can only be called in that lua and global/regular can be called between lua scripts

I thought so too, giving that you define the variable or such.

Still would that above script in my post work?

I believe it would

So is there still any problem?

And you’re remembering to call the function right? XD