Hey, so today i've been trying to save a number value that is located in
workspace.Remotes.PlayerValues[playername].ExtraLives
Then loading the value into
workspace.Remotes.PlayerValues[playername].ChangeEL
But when I enter the game, change my value to something above 0, leave, then rejoin, the value doesn't load.
The following code is what I am using to Save/Load but it doesn't seem to be working and it doesn't give any errors.
ds = game:GetService("DataStoreService"):GetDataStore("Lives") game.Players.PlayerAdded:connect(function(player) repeat wait() until workspace.Remotes.PlayerValues:FindFirstChild(player.Name)~=nil and workspace.Remotes.PlayerValues:FindFirstChild(player.Name).ChangeEL.Script.Disabled==false local lives = workspace.Remotes.PlayerValues:FindFirstChild(player.Name).ChangeEL lives.Value = ds:GetAsync(player.Name) or 0 end) game.Players.PlayerRemoving:connect(function(player) ds:UpdateAsync(player.Name, function(oldValue) return workspace.Remotes.PlayerValues:FindFirstChild(player.Name).ExtraLives.Value end) end) game.OnClose = function() for i,v in pairs(game.Players:GetChildren()) do ds:UpdateAsync(v.Name, function(oldValue) return workspace.Remotes.PlayerValues:FindFirstChild(v.Name).ExtraLives.Value end) end wait(1) end
Thank you.
Woah, super weird fix. ChangeEL was a numberValue so I tried changing it to a IntValue and it worked.