I’m having trouble with datastore2 its not working. I’ve used it for multiple games and it worked fine but this one broke. I don’t know if its that I changed the name or what but the error is:
Model.MainModule:566: DataStore2() API call expected {string dataStoreName, Instance player}, got {string, nil}
Here is the script
local pistols = require(1936396537)
pistols.Combine("MasterKey","M1911", "Glock17","CZ-70", "FiveSeven","CZ-75","Glock19", "Glock18", "Berreta-93R", "R8 Revolver","SWM60","SWM400", "SWM500")
print("debugging1")
game.Players.PlayerAdded:Connect(function(plr)
--//Semi Auto
local datam1911 = pistols("M1911",plr)
local datag17 = pistols("Glock17", plr)
local datacz70 = pistols("CZ-70", plr)
local datafiveseven = pistols("FiveSeven", plr)
--Full Auto
local datag18 = pistols("Glock18", plr)
local datag19 = pistols("Glock19", plr)
local databerreta93r = pistols("Berreta-93R", plr)
local datacz75 = pistols("CZ-75")
--Power Wise
local dataswm400 = pistols("SWM400", plr)
local dataswm500 = pistols("SWM500", plr)
local datar8revover = pistols("R8 Revolver")
local dataswm60 = pistols("SWM60")
--//Semi Auto
local handguns = Instance.new("Folder",plr) --stats folder
handguns.Name = "handguns"
print("debugging2")
local M1911 = Instance.new("IntValue",handguns)
M1911.Name = "M1911"
local g17 = Instance.new("IntValue",handguns)
g17.Name = "Glock17"
local cz70 = Instance.new("IntValue", handguns)
cz70.Name = "CZ-70"
print("debugging3")
local fiveseven = Instance.new("IntValue", handguns)
fiveseven.Name = "FiveSeven"
--//Full Auto
local cz75 = Instance.new("IntValue", handguns)
cz75.Name = "CZ-75"
local g18 = Instance.new("IntValue", handguns)
g18.Name = "Glock18"
local g19 = Instance.new("IntValue", handguns)
g19.Name = "Glock19"
local berreta93r = Instance.new("IntValue", handguns)
berreta93r.Name = "Berreta-93R"
--//Power Wise
local r8revolver = Instance.new("IntValue", handguns)
r8revolver.Name = "R8 Revolver"
local swm60 = Instance.new("IntValue", handguns)
swm60.Name = "SWM60"
local swm400 = Instance.new("IntValue", handguns)
swm400.Name = "SWM400"
local swm500 = Instance.new("IntValue", handguns)
swm500.Name = "SWM500"
--//Get Data
--//Semi Auto
if datam1911:Get() ~= nil then
M1911.Value = datam1911:Get()
else
M1911 = 0
end
if datag17:Get() ~= nil then
g17.Value = datag17:Get()
else
g17.Value = 0
end
if datacz70:Get() ~= nil then
cz70.Value = datacz70:Get()
else
cz70.Value = 0
end
if datafiveseven:Get() ~= nil then
fiveseven.Value = datafiveseven:Get()
else
fiveseven.Value = 0
end
--//Full Auto
if datacz75:Get() ~= nil then
cz75.Value = datacz75:Get()
else
cz75.Value = 0
end
if datag18:Get() ~= nil then
g18.Value = datag18:Get()
else
g18.Value = 0
end
if datag19:Get() ~= nil then
g19.Value = datag19:Get()
else
g19.Value = 0
end
if databerreta93r:Get() ~= nil then
berreta93r.Value = databerreta93r:Get()
else
berreta93r.Value = 0
end
--//Power Wise
if datar8revover:Get() ~= nil then
r8revolver.Value = datar8revover:Get()
else
r8revolver.Value = 0
end
if dataswm60:Get() ~= nil then
swm60.Value = dataswm60:Get()
else
swm60.Value = 0
end
if dataswm60:Get() ~= nil then
swm400.Value = dataswm400:Get()
else
swm400.Value = 0
end
if dataswm60:Get() ~= nil then
swm500.Value = dataswm500:Get()
else
swm500.Value = 0
end
--//Save Data
--//Semi Auto
M1911.Changed:Connect(function()
datam1911:Set(M1911.Value)
end)
cz70.Changed:Connect(function()
datacz70:Set(cz70.Value)
end)
g17.Changed:Connect(function()
datag17:Set(g17.Value)
end)
fiveseven.Changed:Connect(function()
datafiveseven:Set(fiveseven.Value)
end)
--//Full Auto
g18.Changed:Connect(function()
datag18:Set(g18.Value)
end)
g19.Changed:Connect(function()
datag19:Set(g19.Value)
end)
cz75.Changed:Connect(function()
datacz75:Set(cz75.Value)
end)
berreta93r.Changed:Connect(function()
databerreta93r:Set(berreta93r.Value)
end)
--//Power Wise
r8revolver.Changed:Connect(function()
datar8revover:Set(r8revolver.Value)
end)
swm400.Changed:Connect(function()
dataswm60:Set(swm60.Value)
end)
swm500.Changed:Connect(function()
dataswm500:Set(swm500.Value)
end)
end)