My team score updating module is not working, and I cannot seem to find why it will not update the scores.
My code is this:
local module = {}
function module.HandleDeath(plr)
local TS = game.ReplicatedStorage:WaitForChild("TeamScore")
if plr.TeamColor == BrickColor.new("bright red") then
TS.BlueScore.Value = TS.BlueScore.Value + 1
elseif plr.TeamColor == BrickColor.new("Bright blue") then
TS.RedScore.Value = TS.RedScore.Value + 1
else
return nil
end
end
function module:Start()
local teamScore = game.ReplicatedStorage:WaitForChild("TeamScore")
for _,v in pairs(teamScore:GetChildren()) do
v.Value = 0
if teamScore.RedScore.Value == 0 and teamScore.BlueScore.Value == 0 then
break
else
return
end
end
end
return module
If anyone knows why this doesn’t work, please let me know!