Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Auto Team script according to group ranks not correctly working. Anyone?

Asked by
Mqanos 0
5 years ago
Edited by royaltoe 5 years ago

So I've made this

01function onPlayerEntered(plyr)
02 
03if plyr:IsInGroup(5233740)>=10 then
04 
05plyr.TeamColor = BrickColor.new("Bright yellow")
06 
07 
08 
09elseif plyr:IsInGroup(5244884) then
10 
11plyr.TeamColor = BrickColor.new("Navy blue")
12 
13 
14 
15elseif plyr:IsInGroup(5235212) then
View all 35 lines...

But won't work, I have a main group and 3 divisions, so I want when someone joins IF he is a HR in the main group to be teamed Bright yellow, if not check if he is in any of the three divisions and lastly to be teamed in the main group; and I managed to make it work 'till I added the ranks' matter (<= etc.) next to the ID... Can anyone do this for me?

1 answer

Log in to vote
1
Answered by 5 years ago

Hey Mqanos!

Try this script.You were only setting the team color :)

01local teams = game:GetService("Teams")
02 
03game.Players.PlayerAdded:Connect(function(plr)
04    if plr:IsInGroup(5233740) then
05        if plr:GetRankInGroup(5233740) >= 10 then
06            plr.Team = teams.Officers
07            plr.TeamColor = teams.Officers.TeamColor
08        else
09            if plr:GetRankInGroup(5233740) >= 17 then
10                plr.Team = teams.Headquarters
11                plr.TeamColor = teams.Headquarters.TeamColor
12            else
13                plr.Team = teams.Enlisted
14                plr.TeamColor = teams.Enlisted.TeamColor
15            end
View all 33 lines...
0
Works like a charm! Can't accept answear for a reason, there is only the report option, hm? Mqanos 0 — 5y
Ad

Answer this question