(credit to Collin201)
I'm trying to develop a script in which it automatically puts you onto a team if you're in a group (like in most war group bases). This is a fairly acceptable concept, but I'm sure it needs to be worked on and it probably won't function correctly..
1 | function onPlayerEntered() ifPlayer IsInGroup( 2531656 ) then game.Workspace.LocalPlayer.TeamColor = BrickColor.new ( "Dark stone grey" ) |
Any tips? Revisions to the script? Either way it'll be appreciated. Thanks.
First off, you're missing "end" to your code blocks. Also, the team arranger thing should be checked from a server script. Not a local one. And IsInGroup() is a method of Player, so you have to add a colon between Player and IsinGroup()
1 | --Inside a server script |
2 | game.Players.PlayerAdded:connect( --Connect the PlayerAdded event from player to an anonymous function |
3 | function (plr) |
4 | if plr:IsInGroup(GROUPID) then --If the player is in a group with this ID then |
5 | plr.TeamColor = BrickColor.new(BRICKCOLOR) --Put them in this team |
6 | end |
7 | end |
8 | ) |