Okay, so I've been working on a Restaurant and need help making a certain rank go on a certain team. I've tried looking at yt videos but most of them don't work, and a lot don't have the script in the des. Also a lot of them have blurry screens and I cannot see! .Please help, I really want to have a successful game for once!
✓ ANSWER ACCEPTED
How to make a Certain rank be on a Certain Team?
1 answer
✓ Accepted answer
Hey there,
In order to do what you are trying to do, you might want to have a look into teams and GetRankInGroup(), as this will give you a better understanding on the code below.
If you want to have multiple teams for multiple ranks, you can just add more if statements.
local team = game:GetService("Teams") -- the team service
local groupId = 1 -- The group which you are trying to get the rank from
local rank = player:GetRankInGroup(groupId) -- returns a number between 0 and 255
if(rank == 255) then -- owner rank
player.Team = teams["Owner"] -- Owner is the team's name
end
-- If you want to team anyone above a certain rank, you can use >=
If you have any further questions, feel free to ask them, I'm happy to help!
[EDIT]
Since that you seem to be having some struggles with using this, I'll be providing additional help.
You will want to run this code when a player joins, so that they are placed in the right team once they join. We do so, by connecting to the PlayerAdded event.
-- Script
-- To be placed in the ServerScriptService
local players = game:GetService("Players") -- The player service
local team = game:GetService("Teams") -- the team service
local groupId = 1 -- The group which you are trying to get the rank from
players.PlayerAdded:Connect(function(player) -- player is the player that joined the game
local rank = player:GetRankInGroup(groupId) -- returns a number between 0 and 255
if(rank == 255) then -- owner rank
player.Team = teams["Owner"] -- Owner is the team's name
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
Thanks!
Omg! TYSM! I will certainly give credits. This helped me so much!
You don't know how happy I am to know that I helped! :) Good luck with your restaurant! <3
Just to be sure where do we put the script? In teams?
I'm assuming that you have some scripting knowledge, but in case you don't, let me edit my answer
There we go, hope that this helps you!