Team Script not working

This script is meant to give you team based on your rank in a group, but it instead causes you to join a “neutral” team. There are no errors, so I really have no idea,

local Teams = game:GetService("Teams")
local Players = game:GetService("Players")

local function playerAdded(player:Player)
	
	local playerRank = player:GetRankInGroup(33160241)
	

	if playerRank == 2 then
		player.Team = Teams:FindFirstChild("Military")

	end
	
	if playerRank == 1 then
		player.Team = Teams:FindFirstChild("Immigrant")
	end
	
	if playerRank == 254 or 255 then
		player.Team = Teams:FindFirstChild("Owner")
	end
	
end
2 Likes

There’s a mistake here. This will make everyone on the Owner team. You should try:

if playerRank == 254 or playerRank == 255 then

1 Like

How come it still puts you on a neutral team? will it not give a team if there isnt a set spawn location for them or something?

1 Like

Ummm… did you ever call the function? Cuz you put the whole thing in the function without ever calling it.

2 Likes

oh im dumb LOL
tysm for helpping

1 Like

yep that worked! btw while im at, how do i make it so certain teams spawn at different spots

1 Like

When you add a spawn, theres a property called TeamColor. Set it to the Team’s color that you want it to spawn on.

(I think, I know its something like that - I haven’t used it in a while)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.