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

How to put player on team?

I need this script so that once the hunter is chosen the player is assigned to the team called Hunter and others who are not the hunter are assigned to the team called Props.

wait(6)

while true do
h = Instance.new ("Message")
p = game.Players:GetChildren()
randplayer = p[math.random(#p)] --Chooses the random Laser King
randplayer.TeamColor = BrickColor.new("Toothpaste")
randplayer.Character:BreakJoints() 
m = Instance.new("Hint")
m.Parent = workspace
m.Text = randplayer.Name.." is the Hunter "
wait(3)
m.Text = randplayer.Name.." Your goal is to kill all of the Props good luck! "
wait(3)
m.Parent = nil
h.Parent = workspace
h.Text = "Props! You have 2 minutes to hide and survive the hunter! "
wait (5)
h.Parent = nil
hm = randplayer.Character.Humanoid
	hm.MaxHealth=300 --Chooses their max health
	hm.Health=300 --Chooses their current health
wait(120) --This is where you change the leangth of the game
for i = 1,#p do
if p[i].TeamColor == BrickColor.new("Red") then
p[i].TeamColor = BrickColor.new("Red")
end
end
h.Parent = workspace
h.Text = "End of round!"
wait(4)
h.Text = "Get ready for the next round!"
wait (4)
h.Parent = nil

end 


1 answer

✓ Accepted answer

Explain your problem.. I don't see anything bad. You're doing it just fine, but, @25,26

if p[i].TeamColor == BrickColor.new("Red") then
p[i].TeamColor = BrickColor.new("Red") 
--Wait what??

4 comments

0

I need it to be modified so that once it chooses whos the hunter it puts him on a team called Hunter same with props

0

But you just did it? as long as the hunter teamcolor is ToothPaste then you did it, you can't use it by "name", just by teamcolor

0

O ok let me test and see if it works

0

I cant tell if it works because I cant test it with 1 other person but theres not the neutral team anymore so I think it works.

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