My datasave for my simulator is not working, i put this at the bottom of my leaderstats script.pls help.
script:
local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("GameStats")
local Player = game.Players:WaitForChild('Player') local Data = DataStore:GetAsync(Player.UserId) if Data then Player.leaderstats.Bitcoin.Value = Data.Cash Player.leaderstats.Rebirths.Value = Data.Rebirths Player.leaderstats.Ethereum.Value = Data.Ethereum end
game.Players.PlayerRemoving:Connect(function(Player) DataStore:SetAsync(Player.UserId, { ["Bitcoin"] = Player.leaderstats.Cash.Value; ["Rebirths"] = Player.leaderstats.Rebirths.Value; ["Ethereum"] = Player.leaderstats.Ethereum.Value; }) end)
So I copied the script and put it into a code to make it more easier to read it:
local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("GameStats") local Player = game.Players:WaitForChild('Player') local Data = DataStore:GetAsync(Player.UserId) if Data then Player.leaderstats.Bitcoin.Value = Data.Cash Player.leaderstats.Rebirths.Value = Data.Rebirths Player.leaderstats.Ethereum.Value = Data.Ethereum end game.Players.PlayerRemoving:Connect(function(Player) DataStore:SetAsync(Player.UserId, { ["Bitcoin"] = Player.leaderstats.Cash.Value; ["Rebirths"] = Player.leaderstats.Rebirths.Value; ["Ethereum"] = Player.leaderstats.Ethereum.Value; }) end)
Yea this is all. I can't really assort it so here it is