game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new("IntValue") money.Name = "Money" money.Value = 250 money.Parent = leaderstats end) if player.TeamColor == BrickColor.new("Burnt Sienna") then while wait(5) do for _, player in ipairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then player.leaderstats.Money.Value = player.leaderstats.Money.Value + 1 end end end end
The problem is in the "if player.TeamColor =..." part, I know to identify what exactly "player" is, but I don't know what to identify it as. Should it be "player = game.Players" or what?
Edit #1:Actually, I don't even know if the bottom part will work at all even with "player" identified, all help is appreciated.
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new("IntValue") money.Name = "Money" money.Value = 250 money.Parent = leaderstats while wait(5) do if player.TeamColor == BrickColor.new("Burnt Sienna") then if player:FindFirstChild("leaderstats") then money.Value = money.Value + 1 end end end end)
Solved my own problem :)
function onPlayerEntered(newPlayer) wait(.5) local stats = Instance.new("IntValue") stats.Name = "leaderstats" local Money = Instance.new("IntValue") Money.Name = "Money" Money.Value = 500 Money.Parent = stats stats.Parent = newPlayer end game.Players.ChildAdded:connect(onPlayerEntered)
This will work but Ill check over yours and see the problem