Code System, i need help

Hello, Everyone! Im doing code system for my own game, and i need help.
This is my server script:

local mbn = require(script.Module)
local r = game:GetService("ReplicatedStorage").Remotes.Codes

r.OnServerEvent:Connect(function(p, code)
	local c = mbn:CheckCode(code)
	print(c)
end)

Im now trying to test it so, i wrote print(c)
And this is my module:

local module = {}

function module:CheckCode(code)
	local Codes = {
		["Release"] = "Valid"
	}
	
	local v = table.find(Codes, code)
	if v then
		if v == "Valid" then
			return "Valid"
		elseif v == "Expired" then
			return "Expired"
		end
	end
end

return module

I, also have local script but there only fireserver("Release")

I tried to check whats problem that it writing me nil and changed module to that:

local module = {}

function module:CheckCode(code)
	local Codes = {
		["Release"] = "Valid"
	}
	
	local v = table.find(Codes, code)
	if v then
		if v == "Valid" then
			return "Valid"
		elseif v == "Expired" then
			return "Expired"
		end
	else
		return "NotValid"
	end
end

return module

And it returns me “NotValid”, but im writing code that exists in table and its valid. Can you help me with that problem?

Not an expert on using : in module scripts, but ik that people usually put a self argument as the first argument of it (i.e. module:CheckCode(self, code). No idea if that is the cause but may as well try

Also try outputing what the value of code is

That makes sense, i will try later, im busy rn

I would create a variable and use a for loop to search through all the keys to see if the code matches any key. If it does, check the value to see if it’s valid or not.

local validCode = false

for key,val in pairs(Codes) do
    if code == key then
        validCode = true
        if val == "Valid" then
            return "Valid"
        elseif val == "Expired" then
            return "Expired"
        end
    end
end

if not validCode then
   return "Not valid"
end

Written on mobile, sorry for the slow reply.

As far as I know, using the colon passes automatically the self argument.

Thank you very very much, it works very well!