Im trying to make a purchase function for my store gui. the concept is buying animations / dances. and i get this error. "assigning 1 values to 2 values initalises extra variables with nil; add'nil' to value list to silence error"
function Database.OnInvoke(action,...)
local vars = {...}
if action:lower() == "get list" then
return Store.List
elseif action:lower() == "get packs" and (vars[1] and vars[1]:IsA("Player")) then
local plr = vars[1]
local packs,list = SData:GetAsync(plr.userId.."_Packs"),{}
if not packs then SData:SetAsync(plr.userId.."_Packs",{}) packs = {} end
for i,v in ipairs(packs) do
table.insert(list,Store.List[Store:findIdByName(v)])
end
return list,packs
elseif (action:lower() == "buy" or action:lower() == "purchase") and (vars[1] and vars[1]:IsA("Player")) and tonumber(vars[2]) then
local bought = Store:Buy(vars[1],vars[2])
return bought --Did the purchase go through?
elseif action:lower() == "owns pack" and (vars[1] and vars[1]:IsA("Player")) and vars[2] then
local plr,ok = vars[1]
local packs = SData:GetAsync(plr.userId.."_Packs")
if packs then
for i,v in ipairs(packs) do
if v:lower() == tostring(vars[2]):lower() then ok = true break end
end
end
return ok
end
end
function Database.Local.OnServerInvoke(plr,action,...)
return Database:Invoke(action,plr,...)
end
