How do you increase a leaderstat of all players on a specific team? In my game all members of the "Bright red" team is supposed to recieve 150 XP when they win the game, but it is not working.
for i,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == BrickColor.new("Bright red") then v.leaderstats.XP.Value = v.leaderstats.XP.Value + 150
The code looks fine, but I think you're missing two end
s. The final code would look like this:
for i,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == BrickColor.new("Bright red") then v.leaderstats.XP.Value = v.leaderstats.XP.Value + 150 end end