I am having no errors yet it wont save.
local DS = game:GetService("DataStoreService"):GetDataStore("StorageThing") game.Players.PlayerAdded:Connect(function(plr) local stats = Instance.new("IntValue") stats.Name = "leaderstats" stats.Parent = plr local Soul = Instance.new("IntValue") Soul.Name = "Screams" Soul.Parent = stats local keyboi = "player-"..plr.userId local savedvalues = DS:GetAsync(keyboi) if savedvalues then Soul.Value = savedvalues else DS:SetAsync(keyboi,Soul.Value) end end) game.Players.PlayerRemoving:Connect(function(plr) local keyboi = "player-"..plr.userId DS:SetAsync(keyboi,{plr.leaderstats.Souls.Value}) end)
local DS = game:GetService("DataStoreService"):GetDataStore("StorageThing") game.Players.PlayerAdded:Connect(function(plr) local stats = Instance.new("IntValue") stats.Name = "leaderstats" stats.Parent = plr local Soul = Instance.new("IntValue") Soul.Name = "Screams" Soul.Parent = stats local keyboi = "player-"..plr.userId local savedvalues = DS:SetAsync(keyboi) if savedvalues then Soul.Value = savedvalues[1] -- you're trying to set the value to a table, should be savedValues[1] instead else DS:SetAsync(keyboi,{Soul.Value}) end end) game.Players.PlayerRemoving:Connect(function(plr) local keyboi = "player-"..plr.userId DS:SetAsync(keyboi, {plr.leaderstats.Screams.Value}) -- you named the stat "Screams" so it would be 'plr.leaderstats.Screams' end)
Where you declared the Soul variable on the bottom of your code you put leaderstats.Souls Its just an error.