Trying to make a script that checks a code a player sent from the client to the server and returns a value depending on if the code is correct or not.
--Codes game.ReplicatedStorage.RedeemCode.OnServerInvoke = function(player, codesent) --Get DataStore --Get Codes local valid = { "test1", "test2" } local expired = { "test" } --Check Codes for i,expiredcodes in pairs(expired) do if expiredcodes == codesent then return("expired") end for i,codes in pairs(valid) do if codes == codesent then return true else if codes ~= codesent then return false end end end end end
so what I don't understand is that the table with both valid & expired codes work but only if it's the first code on the table.
However if it's on the second line it returns it as invalid.