Ok so I have tried to change the script so it would work and I have tried putting it into teams. 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 = 0 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 players.Money.Value = stats.Money.Value + 1 end wait(5) end function CheckTeams(player) if player.TeamColor == BrickColor.new("Bright red") then player.leaderstats.Money.Value = player.leaderstats.Money.Value + 1 end end
Please help, I don't know what's wrong (yes I do have a team that is brick colour ''Bright red'' so it's not because it's for the wrong team.)