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

How can I effectively change player's teams? [SOLVED]

Asked by
OBenjOne 190
5 years ago
Edited 5 years ago

Hi, I am trying to make it to where Players joining my game have the ability to chose their team. However, when I made a spawn room with a "new Player" spawn (auto assignable) and a red and blue spawn (both not auto assignable) I couldn't find a way to have allow team change on touch without allowing players to accidentally spawning back into the spawn room. Unfortunately, turning enabled to false makes allow team change not work. There are two solutions I can think of, but both are not too great.

  1. Using probability to make the chances of respawning back at the spawn room virtually nil: I could make like 10000 copies of each team's spawn point in the same position so that the chances of spawning in the spawn room would be 1/10000 but this would (I assume) cause lag and the occasional player would spawn in the spawn room making my game look unprofessional.

  2. I could make a script that turns enabled on for 1 second only when a player touches the spawn: There would be a good chance that players would spawn at the spawn while enabled.

Anyone else got more ideas? I know the answer is out there :)

Solved:

Player.Team = game.Teams.Team

Edit; title changed a bit to not sound primarily opinion based.

1 answer

Log in to vote
0
Answered by 5 years ago

You could always set the character's primary part CFrame to the first spawn when they join and then when they choose a team change it to the spawn location they should go to. That, or you can use the RespawnLocation property to make sure they will respawn on the right spawns after they change their team.

Ad

Answer this question