You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the player to get teamed based on their rank before they join in, so they spawn at the correct spawn pad… -
What is the issue? Include screenshots / videos if possible!
When joining in, the player isn’t spawning at the correct spawn pad. I am 99% sure this is because they spawn before they get teamed. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried different scripts and putting the script in the starter player.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local groupId = 14289900
local gPlayers = game:GetService("Players")
gPlayers.PlayerAdded:Connect(function(player)
local playerTeam = ""
local playerRank = player:GetRankInGroup(groupId)
if playerRank >= 2 then
playerTeam = "U.S Personnel"
elseif playerRank == 1 then
playerTeam = "BCT"
elseif playerRank == 0 then
playerTeam = "Citizen"
end
player.Team = game.Teams[playerTeam]
end)