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

How do i add 2 currencys in my datasaving script?

Asked by 3 years ago
Edited 3 years ago

``local dataStore = game:GetService("DataStoreService"):GetDataStore("MushroomsData")

starterMushrooms = 0

game.Players.PlayerAdded:Connect(function(plr)

local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr

local money = Instance.new("IntValue")
money.Name = "Mushrooms"
money.Value = dataStore:GetAsync(plr.UserId) or starterMushrooms
money.Parent = leaderstats

end)

game.Players.PlayerRemoving:Connect(function(plr)

dataStore:SetAsync(plr.UserId, plr.leaderstats.Mushrooms.Value)

end)

0
please, tell us the problem in the description. pwgth 11 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

I also want another currency which is "Cash" But i aint getting it to work..

Ad

Answer this question