Using multiple leaderstats with Datastore 2

Hello I am trying to make multiple leaderstats using Datastore 2. This script works, but whenever I try adding level to a global leaderboard, it does not work and says you can not use two in datastores.
image
Here is my script:


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)
1 Like