Need help fixing a codes system

Hello, I am making a codes system to give rewards. This is my script and I have tried a lot but I am wrong somewhere in the OnServerEvent’s code. There’s no issue in local script.
This was solved!

1 Like

You check it as if it’s a dictionary but add it like an indexed list.

Your line:
if not pCodes[player.Name][T] then

Should use a function:
if not contains(pCodes[player.Name], T) then

function contains(t, value)
for i,v in pairs(t) do
if v == value then return true end
return false
1 Like

Omg, it works !!! Ty for help

1 Like