Team Role's Script isn't Working

Hello! I’m trying to make it so a players Team is determined on their group rank, this script doesn’t work though, I always get ranked to president when I made it so developers ( grouRoleID being 255 ) are supposed to be immigrants so they don’t get ranked to something random or just be unranked.

Here is the script:

local player = game.Players.LocalPlayer
local groupid = 4645854
local President = 253
local VicePresident = 252
local PrimeMinister = 251
local CabinetMinister = 250
local IvorianParliament = 249
local GovernmentOfficials = 248
local MilitaryOfficials = 247
local ForeignDiplomat = 246
local DistinguishedCitizen = 245
local IvorianCitizen = 244
local Imagrant = 0

local gui = script.Parent


if player:GetRankInGroup(groupid) == IvorianCitizen then
	player.TeamColor = BrickColor.new("Cloudy grey")
end

if player:GetRankInGroup(groupid) == DistinguishedCitizen then
	player.TeamColor = BrickColor.new("Dark stone grey")
end

if player:GetRankInGroup(groupid) == ForeignDiplomat then
	player.TeamColor = BrickColor.new("Bright green")
end

if player:GetRankInGroup(groupid) == MilitaryOfficials then
	player.TeamColor = BrickColor.new("Camo")
end

if player:GetRankInGroup(groupid) == GovernmentOfficials then
	player.TeamColor = BrickColor.new("Dark blue")
end

if player:GetRankInGroup(groupid) == IvorianParliament then
	player.TeamColor = BrickColor.new("Bright red")
end

if player:GetRankInGroup(groupid) == CabinetMinister then
	player.TeamColor = BrickColor.new("Sea green")
end

if player:GetRankInGroup(groupid) == PrimeMinister then
	player.TeamColor = BrickColor.new("Deep orange")
end

if player:GetRankInGroup(groupid) == VicePresident then
	player.TeamColor = BrickColor.new("Storm blue")
end

if player:GetRankInGroup(groupid) == President then
	player.TeamColor = BrickColor.new("Electric blue")
end

if player:GetRankInGroup(groupid) == Imagrant then
	player.TeamColor = BrickColor.new("Medium stone grey")
end


if player:GetRankInGroup(groupid) == 255 then
	player.TeamColor = BrickColor.new("Medium stone grey")
end

This script is in StarterPlayerScripts.

their are No Errors at all.

Try changing the player’s team instead of the team color

2 Likes