Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

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.

0

So, how would I script that? Thanks for answering my question too.

3 answers

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.

1 comment

0

I would like for multiple can you share please?

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.

3 comments

0

uhhh... Too much effort just to make multiple teams. Just use a table for staff. Much quicker.

0

its not that, what i mean is that you could just copy paste the elseif part and change the staff members name

0

where do i put this script and what kind of script is it?

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

1 comment

0

Where do I put the script?

This discussion is preserved as it was. New answers, comments, and votes are closed.