Been trying at this for hours but I can't figure out what the issue(s) could be with the scripts. Note:I realize I didn't include making an leaderboard for it because the intValue is under a TextButton
Saving Script
local DataStore = game:GetService("DataStoreService"):GetDataStore("MoneyData") local MoneyHolder = game.StarterGui.SaveDataTest.MoneyHolder game.Players.PlayerAdded:connect(function(player) local MoneyData = Instance.new("IntValue",MoneyHolder) MoneyData.Name = "Money" local key = "player-"..player.userId local savedValues = DataStore:GetAsync(key) if savedValues then MoneyData.Value = savedValues[1] else local valuesToSave = (MoneyData.Value) DataStore:SetAsync(valuesToSave, key) end end)
Loading Script
local DataStore = game:GetService("DataStoreService"):GetDataStore("MoneyData") game:BindToClose(function() game.Players.PlayerRemoved:connect(function(player) local key = "player-"..player.userId local valuesToSave = player.PlayerGui.SaveDataTest.MoneyHolder.Money.Value DataStore:SetAsync(valuesToSave, key) end) game:BindToClose(function() wait(3) end)
Thank you for your help!