Hello everyone, I tried combining DataStore2 before with two leaderstats, and it worked nicely, but then whenever I tried calling the second leaderstats in the game, it said the error that two datas can not be used. So then I split the two leaderstats in to two different scripts, but now the leaderstas is stuck and is not working either. The gold works, but the level does not. Why?
local DataStore2 = require(1936396537)
DataStore2.Combine("ChickenKey","Level")
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)
local DataStore2 = require(1936396537)
DataStore2.Combine("MasterKey","Gold")
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)
This picture shows how my Level is 0 but should actually be 1741. On the bottom, my level should have been 0 at least if it was actually 0 but instead if actually just shows nothing.
That is not the problem. It just shows that Level system is not valid for somer eason. I have used the Nametag script for a long time. Line 28 is just player.leaderstats.Level.Value
Not really sure, I don’t really understand what issue you’re running into here and DataStore2 has a pretty weird way of doing all these things. Good luck though.