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

How do I make an auto join team script more simple?

Asked by 3 years ago
Edited 3 years ago

I have made a script that makes a person automatically join a team depending on what rank they are and what group they are in. E.g If the person has a rank id of 130 or higher they join a team. And if a person has a rank id bellow 130 and is in a certain group it will put them on the team with that group. To make this I had to make 4 separate scripts and it didn't work so I need to make it simpler but don't know how to without ruining the script.

Script 1:

--Auto Team Script
-- >= stands for more than or equal to
-- <= stands for less than or equal to
-- == stands for equals 
GroupId = 7094704 --Your Group Id Number goes here 
RankId = 249 --Your Rank Id Number goes here

function AssignPlayer(Player)

    if Player:GetRankInGroup(7094704) >= RankId then --Put the group id number in the parenthesis 
 Player.TeamColor = BrickColor.new("Crimson") --Put color of the team you want that person to be on, be sure to have the actual teams set up. 
end

end

    end
end

game.Players.PlayerAdded:connect(AssignPlayer)

Script 2:

groupId = 894996 --replace with your group's ID
minRank = 230 --replace with the minimum rank (number) to be specifically teamed (leave as 1 if you want to allow all group members)
teamColor = "Bright blue" --replace with team color for group members to be automatically placed into
otherTeamColor = "Light stone grey" --replace with team color for non-group members

player = game.Players.LocalPlayer

while wait(1) do
    if player:GetRankInGroup(groupId) >= minRank then
        player.TeamColor = BrickColor.new(teamColor)
    else
        player.TeamColor = BrickColor.new(teamColor)
    end
end

game.Players.PlayerAdded:connect(AssignPlayer)

Script 3:

groupId = 7441047 --replace with your group's ID
minRank = 131 --replace with the minimum rank (number) to be specifically teamed (leave as 1 if you want to allow all group members)
teamColor = "Forest green" --replace with team color for group members to be automatically placed into

player = game.Players.LocalPlayer

while wait(1) do
    if player:GetRankInGroup(groupId) >= minRank then
        player.TeamColor = BrickColor.new(teamColor)
    else
        player.TeamColor = BrickColor.new(teamColor)
    end
end

Script 4:

groupId = 894996 --replace with your group's ID
minRank = 1 --replace with the minimum rank (number) to be specifically teamed (leave as 1 if you want to allow all group members)
teamColor = "Bright blue" --replace with team color for group members to be automatically placed into
otherTeamColor = "Light stone grey" --replace with team color for non-group members

player = game.Players.LocalPlayer

while wait(1) do
    if player:GetRankInGroup(groupId) >= minRank then
        player.TeamColor = BrickColor.new(teamColor)
    else
        player.TeamColor = BrickColor.new(teamColor)
    end
end

The first two scripts are for if you are a leader of the game or a newcomer and the two after that team you based on what group you are in.

0
Sorry I forgot to put it in Lua. ConorG234 39 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

You don't need a script. Select the Teams that can't be set by default, then change AutoAssignable to false.

Ad

Answer this question