I am trying to make a code system for the first time but i am getting:
“Line 21: Attempt to index nil with ‘StartTime’”
local DS = game:GetService("DataStoreService")
local Codes = DS:GetDataStore("CodesTest")
local testCode = {
["Yes"] = {
StartTime = 0,
EndTime = 0,
RewardType = "Skin",
RewardItem = "YourMom",
Expired = false
}
}
game.Players.PlayerAdded:Connect(function(plr)
local codeInfo
local s , e = pcall(function()
codeInfo = Codes:GetAsync("123aa")
end)
if s then
if codeInfo.StartTime then
print("yes code valid")
else
print("code not valid")
end
end
if e then
print(e)
end
end)