So I am trying to let people from my group join a game, and get a specific rank, but every script that I do use, it lets people from different ranks also go into that certain team. I do not like having people from a completely different rank allowed to go onto a certain team in game. I only want that ONE rank to be able to go onto that team.
game.Players.PlayerAdded:connect(function(player) if player:GetRankInGroup(4183500)>= 8 then end end)
If you want only one rank to get to a certain team then you shouldn't use the signal >= as It'll apply for everyone in that group that has a rank equal or above 8, use == instead so It'll check only for the players that is on that specific rank which is 8.
To set the player's team you should use the TeamService and set the player's to the specific team you want from there. Your code would be:
Also try to use :Connect more as :connect is deprecated.
local TeamService = game:GetService("Teams") game:GetService("Players").PlayerAdded:Connect(function(Player) if Player:GetRankInGroup(4183500) == 8 then Player.Team = TeamService["YourTeamName"] -- Put the name of the Team. end end)
I suggest to take a look at this Team article as it explains, gives some examples of what you can do with the Team property which will for sure help you with some issues related to that!
Hopefully this helps you with your issue, make sure to accept it if it did solve it!
So I know exactly what you want. You want on player entered, the player would be set into a specific team rank. Here is the script to use(make sure its server side script):
game.Players.PlayerAdded:connect(function(player) if player:GetRankInGroup(4183500)== 8 then player.TeamColor = BrickColor.new("TeamColorHere") elseif player:GetRankInGroup(4183500)== 9 then player.TeamColor = BrickColor.new("TeamColorHere") elseif -- keep repeating this end end)