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

How to put player on team?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Nymint 85
10 years ago

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??
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 Opptitronica 0 — 10y
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 Nymint 85 — 10y
0
O ok let me test and see if it works Opptitronica 0 — 10y
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. Opptitronica 0 — 10y
Ad

Answer this question