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

How to change a players team?

Asked by 10 years ago

i have a script that selects one person to be a killer and the rest to be runners. I need it so once the killer has been selected it changes their team to bright red and once the runners have been selected to change their team to bright blue.

Script That needs editing:

players = game.Players:GetChildren() 
randomp = players[math.random(#players)]
print(randomp.Name .. " is killer")
game.Player.TeamColor = "Bright red";
for i,v in pairs(players)  do 
    if v.Name ~= randomp.Name then
            print(v.Name .. " is runner")
        game.Players.TeamColor = "Bright blue";
        end
end

1 answer

Log in to vote
0
Answered by
jobro13 980 Moderation Voter
10 years ago

This code is okay, but the only thing that goes wrong is setting the TeamColor. TeamColor is a BrickColor and should therefore receive a BrickColor:

players = game.Players:GetChildren() 
randomp = players[math.random(#players)]
print(randomp.Name .. " is killer")
game.Player.TeamColor = BrickColor.new("Bright red");
for i,v in pairs(players)  do 
    if v.Name ~= randomp.Name then
            print(v.Name .. " is runner")
        game.Players.TeamColor = BrickColor.new("Bright blue");
        end
end

0
dosent work NinjoOnline 1146 — 10y
0
Are you using ONLY this code or have you incorporated this somewhere? Is this a server script? Is there output which says "<player name> is killer" ? jobro13 980 — 10y
Ad

Answer this question