Hello I need help on what to do, so far I have tried to put the money earning scripts in the teams, but it doesn't work. Here is the script:
local playerStats = {} --this keeps a list of the stats for each player that enters the game
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local money = Instance.new("IntValue", leaderstats) --We instance a new IntValue as a child of 'leaderstats'
money.Name = "Money" --this is the name you want the leader-stat to be when it shows up in-game.
money.Value = 0 --this is the value of money the new player starts out with. To change this, you can add some more code (shown later)
end)
local money = Instance.new("IntValue", leaderstats)
money.Name = "Money"
money.Value = 200
stats[player] = leaderstats
end)
while true do --infinite loop
for player, stats in ipairs(playerStats) do --loops through each player => stat pair in the table
stats.Money.Value = stats.Money.Value + 2
end
wait(5)
end
I would like an actual script for this or a solution if your answering this. Thanks.

2 comments
Thanks for all the answers I really appreciate it, hopefully it will work now. I have accepted both answers and now you will receive reputation
Okay so I have tried both scripts ImageLabel's one and Shawnyg's one, neither of them work sadly, I did put the teams properly and I did put both of them in workspace and ServerScriptService for tests and so far they haven't worked I still appreciate the answers and hopefully I will get this sorted for my game. Thanks anyway