Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my promotional code system not work?

Asked by 5 years ago
Edited 5 years ago

plrData[Plr]["Codes"] = {} Events.EC.OnServerEvent:Connect(function(Plr, Data) if Data ~= nil or Data ~= "" then local codeToEnter = string.upper(Data) for i, v in pairs (plrData[Plr]["Codes"]) do if v == codeToEnter then print("FOUND") -- code matched, it is definitely there end end if plrData[Plr]["Codes"][codeToEnter] then print("code found, unsuccessful") elseif not plrData[Plr]["Codes"][codeToEnter] then print("new code, engage benefits") table.insert(plrData[Plr]["Codes"], codeToEnter) end end end)

"Data" is just what the player has inputted and fired an event with this information, but despite being in the table 100% using my sanity check measure, this script still thinks the code does not exist within the table, does plrData[Plr]["Codes"][codeToEnter] not actually check to see if the code exists?

Answer this question