{SOLVED}
game.Players.PlayerAdded:connect(function(Player) if Player:IsInGroup(907381) then Player.TeamColor = BrickColor.new("Really red") end end
The script above supposed to put "people who are in a certain group" in a specific team, but it is not working.
Please explain in your answer the following:-
1)Where should I put the script? In Workspace, the "really red" team or somewhere else.
2)Should I use a local script instead?
3)What did you change in the script?{SOLVED}
game.Players.PlayerAdded:connect(function(Player) if Player:IsInGroup(907381) then Player.TeamColor = BrickColor.new("Really red") end end)
game.Players.PlayerAdded:connect(function(Player) if Player:IsInGroup(907381) then Player.TeamColor = BrickColor.new("Really red") end end) -- You need to end the function by placing a bracket.
In this you forgot to close the connect bracket :connect(function etc.. Which meant that the function wasn't connecting to the event you specified, henceforth it did not work. By closing the bracket, it should work. Place this in the Workspace or ServerScriptService, and it should work just fine.
You should put the script in the Workspace. I believe it should be in a regular script, not LocalScript. Try this code out and see if it works:
a = game.Players:GetChildren() game.Players.PlayerAdded:connect(function(Player) for i,v in pairs(a) do if Player:IsInGroup(GROUPIDHERE) then Player.TeamColor = BrickColor.new("Really Red") end end end)