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

Cash every 60 seconds script?

I need a script that gives cash every 60 seconds preferably 5. Here is my leader board script

CashData = game:GetService("DataStoreService"):GetDataStore("CashData")
GemsData = game:GetService("DataStoreService"):GetDataStore("GemsData")

game.Players.PlayerAdded:connect(function(plr)
    local stats = Instance.new('IntValue', plr)
    stats.Name = 'leaderstats'
    local cash = Instance.new('IntValue', stats)
    cash.Name = 'Cash'
    cash.Value = 0

    stats.Name = 'leaderstats'
    local cash = Instance.new('IntValue', stats)
    cash.Name = 'Gems'
    cash.Value = 0
end)

Please help me a could not find a way!

1 answer

✓ Accepted answer

Here's a simple script...

local interval = 60
spawn(function()
	while true do
		for i,v in pairs(game.Players:GetPlayers())do
			v.leaderstats.Cash.Value = v.leaderstats.Cash.Value + 5
		end
		wait(interval)
	end
end)

1 comment

0

Would recommend adding checks..such as, checking if the player actually has leaderstats before you go to change their cash

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