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

Why can't I change the team color of all players on an event?

Asked by
jacobwow 140
9 years ago

The issue seems to be near .TeamColor = "Lavender"
If you see anything else wrong tell me.

local Goal = script.Parent
local debounce = false
local GoalVal = script.Parent.Goals

function onTouch(part)
    local Ball = part.Parent:findFirstChild("ScoreBall")
    if Ball ~= nil and debounce == false then
        local Mes = Instance.new("Message")
        Mes.Text = "Blue Team Scored!"
        Mes.Parent = game.Workspace
        GoalVal.Value = GoalVal.Value + 1
        debounce = true
        wait(5)
        local pl = game.Players:GetChildren()
        for i=1,#pl do
        pl[i].Character.Humanoid.Health = 0
        Mes:Remove()
        debounce = false
        end
    end
    end

Goal.Touched:connect(onTouch)

function Endgame()
    wait(4.9)
    local Mesa = Instance.new("Message")
    Mesa.Text = "Blue Team Has Won"
    local pla = game.Players:GetChildren()
        for i=1,#pla do
        pla[i].TeamColor = "Lavender" -- HERE
        GoalVal.Value = 0
        game.Workspace.Field.RGoalTrigger.Goals.Value = 0
        wait(10)
        Mesa.Text = "Teams And Scores Reset."
        wait(3)
        Mesa:Remove()
    end
end

while true do
    wait(.0001)
if GoalVal.Value == 2 then
    Endgame()
end
end

1 answer

Log in to vote
2
Answered by
RM0d 305 Moderation Voter
9 years ago
.TeamColor = BrickColor.new("Lavender")

Try that! Should work Brickcolor returns a value known as brickcolor and a string is not a brickcolor so you got to convert it :D

Ad

Answer this question