If you switch teams from Bright green, then go back to that team, it stops working.
function onPlayerEntered(newPlayer) local stats = Instance.new("IntValue") stats.Name = "leaderstats" local points = Instance.new("IntValue") points.Name = "Currency" points.Value = 0 stats.Parent = newPlayer points.Parent = stats while true do if newPlayer.TeamColor == BrickColor.new('Bright green') then wait(5) points.Value = points.Value + 50 end end end game.Players.PlayerAdded:connect(onPlayerEntered)
You have to make sure the team color of the team you inserted is set to 'Bright green' or it will not work.
In the properties of TEAM [if you don't see it, go to Model > Services > Team]. add a new team, or go to toolbox, roblox sets, and insert 'Bright green team'. After that your code should work.
If you insert a new team, under properties of 'Team Color' find 'Bright green' and change to that. Then it should work
If it works, make sure to hit that 'answer' button to help us both out!
If it doesn't work, please comment down below if you find any errors.
Thanks.
Edit 1: Error: When a player gets off the green team, the script keeps looping and looping. Causing it to break.
Solution: Move the 'wait()' statement out of the if, under the while true loop.