Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make an auto team script for one specific rank for a group?

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)

3 comments

0

Please post your code together your your thread.

0

Ok

0

It’s at the bottom of the Answer, near “Report” and the Comments section. it’ll also be prompted to you on the Right.

2 answers

✓ Accepted answer

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!

5 comments

0

You 100% answered my question! Thank you!

0

Np :D Make sure to accept the answer if it solved your question!

0

Where do I go to accept? Sorry I just joined the website

0

Oof, I don't really know either since I never actually made a question, there might be a button around the post that lets your do that.

0

It’s not a Signal, it’s called an Operator

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.