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

How to make leaderstats & give money value +10 every minute?

Asked by 4 years ago

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:

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
Yeah, it's the recommend way to use it. Xapelize 2658 — 4y
Ad

Answer this question