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

Script doesn't team me to proper team based on my group rank?

I made script that should team me to tea, based on my rank group, but it teams me to random team, can someone help me fix this?

local Teams = game:GetService("Teams")
local Visitorst = Teams:WaitForChild("Visitors")
local LowRankt = Teams:WaitForChild("Low Ranks")
local MiddleRankt = Teams:WaitForChild("Middle Ranks")
local HighRankt = Teams:WaitForChild("High Ranks")
local SeniorHighRankt = Teams:WaitForChild("Senior High Ranks")
local HeadOfficet = Teams:WaitForChild("Head Office")
local Ownershipt = Teams:WaitForChild("Ownership Team")

local groupID = 16522602

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		local playerank = player:GetRankInGroup(groupID)
		
		if playerank >= 253 then
			player.Team = Ownershipt
		elseif playerank >= 247 then
			player.Team = HeadOfficet
			print("Hello world")
		elseif playerank >= 243 then
			player.Team = SeniorHighRankt
		elseif playerank >= 236 then
			player.Team = HighRankt
		elseif playerank >= 225 then
			player.Team = MiddleRankt
		elseif playerank >= 115 then
			player.Team = LowRankt
		elseif playerank >= 1 then
			player.Team = Visitorst
		end
	end)
end)

2 comments

0

are there any errors in output?

0

No

1 answer

✓ Accepted answer

I think I know where you have gone wrong

you need to use the TeamColor attribute

like so:

player.TeamColor = Ownershipt.TeamColor

let me know If it works once you try this.

2 comments

0

Doesn't work

0

Nevermind, it works.

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