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

Does anyone have a code for a script that gives you cash every second?

I have tried to come up with one but when ever I try one it never works! Can anyone please help me with this. I have tried this script that I made but did not work.

game.Players.PlayerAdded:connect(function(plr)  
    pcall(function() coroutine.resume(coroutine.create(function()     
        while true do      
            wait(60)      
            plr.leaderstats.cash.Value = plr.leaderstats.cash.Value + 100      
        end))    
    end)    
end)

1 answer

game.Players.PlayerAdded:connect(function(Player)

	local leaderstats = Instance.new("Folder", Player) -- Instance.new(ClassName, Parent)
	leaderstats.Name = "leaderstats"

	local Cash = Instance.new("IntValue", leaderstats)
	Cash.Name = "Cash"
	Cash.Value = 0 -- Starting Cash Value
	
	spawn(function()

		local Amount = 1 -- Set this to the amount you want generated every second

		while wait(1) do -- looping every second
			Cash.Value = Cash.Value + Amount -- now adding
		end

	end)

end)

1 comment

0

thank you so much! :)

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