Check if found entity is local player?

So i got this loop:

for _,v in ipairs (ents.FindByClass("player")) do -- Get players

// Do stuff


How would i make it exclude doing stuff to the local player? (Its an clientside script)

I’ve already tried

if not v == LocalPlayer() then


but that excludes all players for some reason

Sooo, like this?

for k, v in ipairs(player.GetAll()) do
if v != LocalPlayer() then

Why would you use ents.FindByClass(“player”) instead of player.GetAll()?

Whats the difference between

for _,v in ipairs


for k, v in ipairs


And i didn’t know about player.GetAll :stuck_out_tongue:

They’re variables, they equal the same value.

for k, v in ipairs
for a, b in ipairs
for a, f in ipairs
for gdsf, asdas in ipairs

All the same.

The underscore is commonly used for variables that won’t be used (it doesn’t delete them or anything but it makes it easier to see what the code does)

So if in correct, In the first line, K is an counter and V is an entity in my case?

we call it k,v aka k = key, and v = value. So yes, k can be the counter in a int-indexed table.