So, I want to make script that makes you join team automatically bases on your group rank. When I test game, it just joins me to random team.
Heres script:
local Visitorst = game:GetService("Teams"):WaitForChild("Visitors")
local LowRankt = game:GetService("Teams"):WaitForChild("Low Ranks")
local MiddleRankt = game:GetService("Teams"):WaitForChild("Middle Ranks")
local HighRankt = game:GetService("Teams"):WaitForChild("High Ranks")
local SeniorHighRankt = game:GetService("Teams"):WaitForChild("Senior High Ranks")
local HeadOfficet = game:GetService("Teams"):WaitForChild("Head Office")
local Ownershipt = game:GetService("Teams"):WaitForChild("Ownership Team")
local groupID = 16522602
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
if player:IsInGroup(groupID) then
local playerank = player:GetRankInGroup(groupID)
if playerank >= 253 then
player.Team = Ownershipt
elseif playerank >= 247 and not (playerank >= 253) then
player.Team = HeadOfficet
elseif playerank >= 243 and not (playerank >= 247) then
player.Team = SeniorHighRankt
elseif playerank >= 236 and not (playerank >= 243) then
player.Team = HighRankt
elseif playerank >= 225 and not (playerank >= 236) then
player.Team = MiddleRankt
elseif playerank >= 115 and not (playerank >= 225) then
player.Team = LowRankt
elseif playerank >= 1 and not (playerank >= 115) then
player.Team = Visitorst
end
end
end)
end)
Only one should print, the team you get put into should be the only one printing. Are you able to send the updated code as well as the prints? (including your rank print)
I just tested this and it seems to be working fine. Are you sure that you saved it?
Here’s the code I used: local Visitorst = game:GetService(“Teams”):WaitForChild(“Visitors”)
local LowRankt = game:GetService(“Teams”):WaitForChild(“Low Ranks”)
local MiddleRankt = game:GetService(“Teams”):WaitForChild(“Middle Ranks”)
local HighRankt = game:GetService(“Teams”):WaitForChild(“High Ranks”)
local SeniorHighRankt = game:GetService(“Teams”):WaitForChild(“Senior High Ranks”)
local HeadOfficet = game:GetService(“Teams”):WaitForChild(“Head Office”)
local Ownershipt = game:GetService(“Teams”):WaitForChild(“Ownership Team”)
local groupID = 16522602
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
if player:IsInGroup(groupID) then
local playerank = player:GetRankInGroup(groupID)
if playerank >= 253 then
player.Team = Ownershipt
elseif playerank >= 247 and not (playerank >= 253) then
player.Team = HeadOfficet
elseif playerank >= 243 and not (playerank >= 247) then
player.Team = SeniorHighRankt
elseif playerank >= 236 and not (playerank >= 243) then
player.Team = HighRankt
elseif playerank >= 225 and not (playerank >= 236) then
player.Team = MiddleRankt
elseif playerank >= 115 and not (playerank >= 225) then
player.Team = LowRankt
elseif playerank >= 1 and not (playerank >= 115) then
player.Team = Visitorst
end
end
end