I have a money system but I need 1000 money to be given every 3600 seconds (1hour) how would I do this?
a while wait() loop will work for this
while wait(3600) do
money.Value += 10000
end
would that just go in the same script as the leaderstats?
yeah, just put it inside of where you make the leaderstats when the player joins and it should work.
there’s a red line under money.
``
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Cash"
money.Parent = leaderstats
end)
while wait(1) do
money.Value += 10000
end
``
put it inside the player added event. Also, you have it running every second, not 3600 seconds lol.
what do you mean by player added event? and its 1 for testing purposes
this is a playeradded event. put it inside of there
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Cash"
money.Parent = leaderstats
while wait(1) do
money.Value += 10000
end
end)
Note that this will add money every hour that the player is playing the game, so if that player leaves the game than it will count to an hour from 0 again, so the player will have to stay in the game for an hour to get it.