Actually, you didn’t set the DS2 properly. I suggest you to take a look at youtube, i found one or 2 videos. As i am using DataStore2 too, i learn’t on youtube and it works pretty fine now
game.Players.PlayerAdded:Connect(function(plr)
local dataLevel = DS2("leaderlevs", plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderlevs"
local Levels = Instance.new("IntValue", folder)
Levels.Name = "Levels"
local Exp = Instance.new("IntValue", folder)
Exp.Name = "Exp"
local tableToSave = dataLevel:Get({exp = 0, lvl = 0}) -- dataLevel:Get([DefaultValue])
-- If :Get() found any value, set that value to my exp, else, get the value from defaultTable
Levels.Value = tableToSave.lvl
Exp.Value = tableToSave.exp
-- Whenever my exp changes, set the value in the table to my exp, and save the table
Levels.Changed:Connect(function()
tableToSave.lvl = Levels.Value
dataLevel:Set(tableToSave)
end)
Exp.Changed:Connect(function()
tableToSave.exp = Levels.Value
dataLevel:Set(tableToSave)
end)
end)