Hi, I need to know how to make a Team Change by Rank script that means people in the main group that are in a Regiment will be in their Regiments team, and then if they aren't in a regiment they are in the standard "Personnel" team. This is for my Army group.
COMMUNITY QUESTION
How do I make a Team Change that accounts for Regiments?
1 answer
Wait I solved it myself.
Had to simply put the Regiment team before the main team in the script, so the script will consider whether you are in a regiment or not before considering the main group, here was the script:
function onPlayerEntered(plyr)
if plyr:GetRankInGroup(11187505) > 0 then -- on this line is the Regiments ID, make sure to put other Regiment IDs before the main group ID
plyr.TeamColor = BrickColor.new("Storm blue")
elseif plyr:GetRankInGroup(11184473) >= 251 then -- the main group ID
plyr.TeamColor = BrickColor.new("Gold")
elseif plyr:GetRankInGroup(11184473) <= 250 then
plyr.TeamColor = BrickColor.new("Black")
elseif plyr:GetRankInGroup(11184473) == 0 then
plyr.TeamColor = BrickColor.new("Shamrock")
end
end
game.Players.PlayerAdded:Connect(onPlayerEntered)
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Wait()
wait(1)
player:LoadCharacter()
end)
-- script made by iPrinceOfFire
This discussion is preserved as it was. New answers, comments, and votes are closed.
