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

How can I automatically assign a player name to a team in ROBLOX?

Asked by 8 years ago

Okay, so I was building a place that involves staff members and normal players for an interview center. The group doesn't have anybody ranked yet so I'm not doing that kind of script where a certain rank gets the Staff team. I can't really script, so it would be very helpful if someone would do that.

Put the certain player name in that team (It's called "Staff"). Spawn the player on that spawn platform associated with the team.

Thank you for replying or answering my question,

fox9191

0
You could just make a PlayerAdded function and check if the player's name is that certain name, and if it is change the player's TeamColor. Warfaresh0t 414 — 8y
0
So, how would I script that? Thanks for answering my question too. fox9191 0 — 8y

3 answers

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago
game.Players.PlayerAdded:connect(function(p) -- When a player join
if p.Name == "AdminName" then -- Check player's name

p.TeamColor = BrickColor.new("Really red") -- Change team

end
end)

This is meant for one person, if you wanna do multiple you'll have to make a table and a for loop. Ask me if you want that.

0
I would like for multiple can you share please? Meden321 0 — 5y
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

This will make sure that all of your staff will be one the team:

game.Players.PlayersAdded:connect(function(playerJoin)
    if playerJoin.Name == "the staff member's name" then
        playerJoin.TeamColor = BrickColor.new("color of the staff team")
        playerJoin.Team = "Staff"
    elseif playerJoin.Name == "another staff member's name" then
        playerJoin.TeamColor = BrickColor.new("color of the staff team")
        playerJoin.Team = "Staff"
    end
end)

However, the only way that this will work is to do the elseif part many times if you have more than 2 staff members.

0
uhhh... Too much effort just to make multiple teams. Just use a table for staff. Much quicker. fireboltofdeathalt 118 — 8y
0
its not that, what i mean is that you could just copy paste the elseif part and change the staff members name marioblast1244 113 — 8y
0
where do i put this script and what kind of script is it? TheRabster1428 0 — 5y
Log in to vote
0
Answered by
TNTIsLyfe 152
5 years ago

function onPlayerEntered(plr) if plr.UserId == 125436495 then

plr.TeamColor = BrickColor.new("Teal") plr:LoadCharacter() end end

game.Players.PlayerAdded:connect(onPlayerEntered)

This is the new version since roblox has updated. It uses a user id to tell which person to give the team to and sadly only for a single person i dont know how to make it for multiple

0
Where do I put the script? LinkZelda_Sage 16 — 4y

Answer this question