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
