[HELP] GetAllPeds(): how to get single value from list

I’m trying to work with GetAllPeds(), which returns a table/list and I cant quite seem to figure out how to get each value individually.

image
image

It would be great if someone could help me get more familiar with tables in fivem or could show exactly what’s wrong with my code.

In your for loop the i refers to the key you need to do for k,v in pairs(peds) where k is key and v is value. Value being the ped handle.

This is just Lua by the way, nothing special with FiveM

wait(10000)  
while true do
    wait(5000) 
    local peds = GetAllPeds()
    for i, ped in ipairs(peds) do
        print(i, ped)
    end
end

tbh the last time I used LUA was in roblox :confused:
So thanks for the reminder!

lol I also didnt capitalize the Wait()… no wonder nothing was coming out in the first place