#im making a game with 2 teams and i would like it so when i select my team it gives me a custom rig

1 messages · Page 1 of 1 (latest)

modest ocean
#
local Teams = game:GetService("Teams") -- team service
local Players = game:GetService("Players") -- getting the players

local function assignRoles()
    -- defining the team names to make it more readable and clear
    local killerTeam = Teams.Killer
    local survivorTeam = Teams.Survivor
    
    local killer = false -- to control a while loop later to make sure only 1 player is a killer

    local allPlayers = Players:GetPlayers() -- getting all players
    
    -- here we just loop the players to make them default to survivor
    for _, player in pairs(allPlayers) do
        if player.TeamColor ~= "Really Red" then -- only the killer uses Really Red team colour 
            player.Team = survivorTeam -- sets them to survivor team
        end
    end

    if killer == false then -- if there is no killer
        for _, player in pairs(Players:GetPlayers()) do
            while killer == false do -- while the killer isnt found do the indented code
                player.Team = killerTeam -- set the player to killer
                killer = true -- set the killer to true to break the loop so no other players get killer
                break
            end
        end
    end
end
assignRoles()

print("script loaded")
#
  • create 2 team objects inside of teams in studio
#

name them whatever and colour them whatever

#

this specific script makes 1 player in the lobby a "Killer" and the rest survivors so you will need to take it
understand it
then suit it to your needs

#

@cedar kindle

#
if player.Team and player.Team.Name == "Killer" then
#

if you want to go off the name of the team object just do this