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

How to add player to a team?

Asked by 5 years ago
Edited 5 years ago

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
0
You're using "or" incorrectly. "or" takes a condition after it is typed, not a string or type of data. DeceptiveCaster 3761 — 5y
0
no bestrobloxerall -10 — 5y
0
local Player = game.Players:GetPlayerFromCharacter(hit.Parent) if Player.Name == "Fefefefe234", "YOLOchickenBRO" then Player.Team = game.Teams.TEAMCOLOR end bestrobloxerall -10 — 5y
0
You use Team Colors not teams bestrobloxerall -10 — 5y

1 answer

Log in to vote
0
Answered by
zeptak 4
5 years ago

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 :)

0
Will "If" operator work if "I" typed in caps, I'm just lua starter. Fefefefe234 0 — 5y
0
Also, can I use variable instead "yourname". Oof, I'll just test. Fefefefe234 0 — 5y
0
Didn't work :c Fefefefe234 0 — 5y
0
You need to make "If" to all non capitals. Also, try 'Player.TeamColor = Color3.new(--ColorHere!, RGB.) User#22722 20 — 5y
Ad

Answer this question