This DataStore2 Works, but when I use this, the gold for some reason with the other scripts does not go up or down anymore, and only some of the coins that the players collect do not work for Gold and only for level for some reason and the other scripts for the gold do not work anymore.
DataStore2.Combine("MasterKey","Gold","Level")
game.Players.PlayerAdded:Connect(function(plr)
local dataGold = DataStore2("Gold", plr)
local folder = Instance.new("Folder",plr)
folder.Name = "leaderstats"
local gold = Instance.new("IntValue", folder)
gold.Name = "Gold"
if dataGold:Get() ~= nil then
gold.Value = dataGold:Get()
else
gold.Value = 100
end
gold.Changed:Connect(function()
dataGold:Set(gold.Value)
end)
end)
game.Players.PlayerAdded:Connect(function(plr)
local dataLevel = DataStore2("Level", plr)
local folder = Instance.new("Folder",plr)
folder.Name = "leaderstats"
local level = Instance.new("IntValue", folder)
level.Name = "Level"
if dataLevel:Get() ~= nil then
level.Value = dataLevel:Get()
else
level.Value = 0
end
level.Changed:Connect(function()
dataLevel:Set(level.Value)
end)
end)