So I'm making a game and it needs leaderstats. The money (Cupcakes) is the in-game currency. I also want the game to give the player +10 Cupcakes every minute (60 seconds.) So if anyone has a script(s) for this, I would be glad to try it out! -Ally c:
COMMUNITY QUESTION
How to make leaderstats & give money value +10 every minute?
1 answer
This is what you need to do; Insert a script, and type:
local dataStore = game:GetService(“DataStoreService”):GetDataStore(“Cupcakes”)
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new(“Folder”,plr)
folder.Name = “leaderstats”
local cupcakes = Instance.new(“IntValue”,leaderstats)
cupcakes.Value = dataStore:GetAsync(plr.UserId)
while wait(60) do
cupcakes.Value = cupcakes.Value + 10
dataStore:SetAsync(cupcakes.Value, plr.UserId)
end
end)
Sorry if it’s a bit messy, I’m doin this on my phone :0
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Yeah, it's the recommend way to use it.