Hey there! I apologise if this has been solved before but I have looked everywhere and not been able to achieve what I wanted.
I am trying to make a script that teams a player based on what groups they are in, the problem is, is that there are many groups going to one team and players might be in two of those same groups. I own a little military group which has a main group, division groups, then unit groups and I want to team a player based on their division. I had some code written and placed it into a local script on startcharacterscripts but it still didnt work. I checked the output but nothing was written there.
I know it is very messy and any help would be much appreciated! Sorry if this has been asked before.
function onPlayerEntered(plr)
local Fighter = 9503940
local BCT = 9503920
local SOW = 9507285
local OTS = 9503903
local STG = 9503909
local AFSOC = 9503738
local ACC = 9503755
local AETC = 9503758
local Main = 8788176
if plr:IsInGroup(Fighter) then
plr.TeamColor = BrickColor.new("Really black")
else if plr:IsInGroup(ACC) then
plr.TeamColor = BrickColor.new("Really black")
else if plr:IsInGroup(BCT) then
plr.TeamColor = BrickColor.new("Deep blue")
else if plr:IsInGroup(OTS) then
plr.TeamColor = BrickColor.new("Deep blue")
else if plr:IsInGroup(AETC) then
plr.TeamColor = BrickColor.new("Deep blue")
else if plr:IsInGroup(SOW) then
plr.TeamColor = BrickColor.new("Neon orange")
else if plr:IsInGroup(STG) then
plr.TeamColor = BrickColor.new("Neon orange")
else if plr:IsInGroup(AFSOC) then
plr.TeamColor = BrickColor.new("Neon orange")
else if plr:IsInGroup(Main) then if plr:GetRankInGroup(Main) == 1 then
plr.TeamColor = BrickColor.new("Really red")
else if plr:IsInGroup(Main) then if plr:GetRankInGroup(Main) >= 20 then
plr.TeamColor = BrickColor.new("CGA Brown")
else if plr:IsInGroup(Main) then
plr.TeamColor = BrickColor.new("Earth green")
plr:LoadCharacter()
end
end
end
end
end
end
end
end
end
end
end
end
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)