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

How to add player to a team?

I'm creating game wheree I want to add to team someone when they joined the game. But how? Wwhen I'm adding myself in Developer team, when I pressed start, my team changed to "Survivor"(this is basic team). Help, please. Script or something else. Also, can I know where I need put script, local or no.

local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
 if Player.Name == "Fefefefe234" or "YOLOchickenBRO" then
  Player.Team = game.Teams.Developers

end

4 comments

0

You're using "or" incorrectly. "or" takes a condition after it is typed, not a string or type of data.

0

no

0

local Player = game.Players:GetPlayerFromCharacter(hit.Parent) if Player.Name == "Fefefefe234", "YOLOchickenBRO" then Player.Team = game.Teams.TEAMCOLOR end

0

You use Team Colors not teams

1 answer

I think you can just make it

local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
If Player.Name == "YourName" then
	Player.Team = "Developers" / Player.TeamColor = BrickColor.new("COLOR OF TEAM")
end

Hope this helped :)

4 comments

0

Will "If" operator work if "I" typed in caps, I'm just lua starter.

0

Also, can I use variable instead "yourname". Oof, I'll just test.

0

Didn't work :c

0

You need to make "If" to all non capitals. Also, try 'Player.TeamColor = Color3.new(--ColorHere!, RGB.)

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