For some reason when I try to call the level leaderstats it does not work on a leaderboard and says I can to call two datas. Why is that?
DataStore2.Combine("MasterKey","Gold","Level")
game.Players.PlayerAdded:Connect(function(plr)
local datastores = {
["Gold"] = DataStore2("Gold", plr),
["Level"] = DataStore2("Level", plr)
}
local datas = {
["Gold"] = datastores["Gold"]:Get(),
["Level"] = datastores["Level"]:Get()
}
local folder = Instance.new("Folder",plr)
folder.Name = "leaderstats"
local gold = Instance.new("IntValue", folder)
gold.Name = "Gold"
local level = Instance.new("NumberValue", folder)
level.Name = "Level"
if datas["Gold"] ~= nil then
gold.Value = datas["Gold"]
else
gold.Value = 100
end
if datas["Level"] ~= nil then
level.Value = datas["Level"]
else
level.Value = 0
end
gold.Changed:Connect(function()
datastores["Gold"]:Set(gold.Value)
end)
level.Changed:Connect(function()
datastores["Level"]:Set(level.Value)
end)
end)