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?