Making Players join a team after being selected

In my role selection code, I have it so 1 person is a murderer and the rest are survivors, once picked I want them to join a team, is there anyway to add that? Do I need any type of local to go along with it aswell?

Simply just change the player’s team.

plr.Team = game:GetService("Teams").Murderer
plr.Team = game:GetService("Teams").Survivor
1 Like

do I just put these in murderer and survivor sections or do I need a local?

1 Like

?

1 Like

you can make another script that gives knife to murder team. still no need for local.

i’m just wondering how to make someone join the team when selected

first put everyone into survivor team… or just make it everyone joins it then
chosen.Team = game:GetService(“Teams”).Murderer

sorry for asking you to do this but I don’t really understand so you would you mind kinda giving me a example?

wait(5)
local chosen = plrs:GetPlayers() [math.random(1, #plrs:GetPlayers())]

chosen.PlayerGui.Picker.Background.RoleGiven.Text = (“Murderer”)
chosen.PlayerGui.Picker.Background.RoleGiven.TextColor3 = Color3.fromRGB(255,0,0)
chosen.PlayerGui.Picker.Background.Visible = true
chosen.Team = game:GetService(“Teams”).Murderer – here

KillerWeapon:Clone().Parent = chosen.Backpack

for i, plr in pairs(plrs:GetPlayers()) do

if plr ~= chosen then

table.insert(survivors, plr)

plr.PlayerGui.Picker.Background.RoleGiven.Text = “Survivor”
plr.PlayerGui.Picker.Background.RoleGiven.TextColor3 = Color3.fromRGB(0,255,0)
plr.Team = game:GetService(“Teams”).Survivor – here

plr.PlayerGui.Picker.Background.Visible = true

end
end

this worked, the caps and " " where messed up so I fixed them and now I switch teams! Thanks a lot! <3