Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

DataSave not working? This is in my leaderstats.

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)

2 comments

0

Please use a code block so that we can read it easily. There should be a Lua symbol on top of the text box.

0

Please provide your issue with the script.

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.