I need to know how to put players in teams based on a group? like, if you are a site manager, it will put you in the site administration team. Thanks for the help!
01 | game.Players.PlayerAdded:connect( function (Plyr) |
02 | Plyr.CharacterAdded:connect( function (Char) |
03 | wait() |
04 | if Plyr:IsInGroup( 4878928 ) then |
05 | Char:MoveTo(script.Parent.Position) |
06 | Plyr.TeamColor = BrickColor.new( "Really black" ..script.Parent.TeamColor) |
07 | else |
08 | end |
09 | end ) |
10 | end ) |
11 |
12 | --How to make rank spawns? |
13 |
14 | --? |
if it helps: https://web.roblox.com/groups/4878928/Alfa-Labs#!/about
for this you're going to want :GetRankInGroup(Id)
01 | local GroupId = 4878928 |
02 |
03 | game.Players.PlayerAdded:connect( function (Plyr) |
04 | Plyr.CharacterAdded:connect( function (Char) |
05 | wait() |
06 |
07 | if Plyr:IsInGroup(GroupId) then |
08 | local rank = Plyr:GetRankInGroup(GroupId) |
09 | if rank = = 255 then -- owner |
10 |
11 | elseif rank = = 50 then -- rank 50 |
12 |
13 | else |
14 | print ( 'Everyone else' ) |
15 | end |
If you have any questions, feel free to ask!
You can make a list with color names for the groups like so:
1 | local groups = { |
2 | owner = BrickColor.new( "Really black" ), |
3 | admin = BrickColor.new( "Dark grey" ), |
4 | default = BrickColor.new( "Mid gray" ) |
5 | } |
You can then do your check when they join, and assign them the right team like so:
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | player.CharacterAdded:Connect( function (char) |
03 | if player:IsInGroup( 4878928 ) then |
04 | local rank = player:GetRankInGroup( 4878928 ) |
05 |
06 | if rank = = ownerID then |
07 | player.TeamColor = groups [ "owner" ] ; |
08 | else if rank = = adminID then |
09 | player.TeamColor = groups [ "admin" ] ; |
10 | else |
11 | player.TeamColor = groups [ "default" ] ; |
12 | end ; |
13 | else |
14 | player.TeamColor = groups [ "default" ] ; |
15 | end ; |
16 | end ); |
17 | end ); |
You can do the same for locations and teleport them to locations.
Make sure that you create the team objects with the same colors as you define in your code. You can then give them any name you want in the Teams folder.