Array value returns nil

users = {}


AddEventHandler('chatMessage', function(source, name, msg)
	sm = stringsplit(msg, " ");
	if sm[1] == "/test" then
	--TriggerClientEvent("yt:policeLoadout", source)
	print(users[source])
    end
end)

AddEventHandler('playerConnecting', function(source, playerName, setKickReason)

	local source = source
    users[source] = playerName
end)

function stringsplit(inputstr, sep)
    if sep == nil then
        sep = "%s"
    end
    local t={} ; i=1
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        t[i] = str
        i = i + 1
    end
    return t
end

print(users[source]) returns nil, why?

Clearly because the users array is not defined anywhere?

It is, scroll up in my code.

I don’t understand, what are you trying to say? What post withdrawn by author means dude?

He deleted the post, therefore it can not be seen.