Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

DataSave not working? This is in my leaderstats.

Asked by 2 years ago

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)

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. NotThatFamouss 605 — 2y
0
Please provide your issue with the script. enes223 327 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

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

Ad

Answer this question