So what this script is supposed to do is make it when the boolValue "Voting" = true then it determines which team got the most votes, and then gives each player on that team +1 win and player points. However, it only awards the win and points if orange wins, which gives them the win and points.
while true do wait() local b = script.Parent.Blue.Value local o = script.Parent.Orange.Value local y = script.Parent.Yellow.Value local g = script.Parent.Green.Value pps = game:GetService("PointsService") if script.Parent.Voting.Value == true then if b >= o and y and g then for i, v in pairs(game.Players:GetPlayers()) do if v.TeamColor == game.Teams["Builder - Blue"].TeamColor then v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1 if pps:GetAwardablePoints() >= 1 then pps:AwardPoints(v.userId, b) end print("No") end end elseif o >= y and g and b then for i, v in pairs(game.Players:GetPlayers()) do if v.TeamColor == game.Teams["Builder - Orange"].TeamColor then v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1 if pps:GetAwardablePoints() >= 1 then pps:AwardPoints(v.userId, o) end print("No") end end elseif y >= g and b and o then for i, v in pairs(game.Players:GetPlayers()) do if v.TeamColor == game.Teams["Builder - Yellow"].TeamColor then v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1 if pps:GetAwardablePoints() >= 1 then pps:AwardPoints(v.userId, y) end print("No") end end elseif g >= b and o and y then for i, v in pairs(game.Players:GetPlayers()) do if v.TeamColor == game.Teams["Builder - Green"].TeamColor then v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1 if pps:GetAwardablePoints() >= 1 then pps:AwardPoints(v.userId, g) end print("Yes") end end end script.Parent.Voting.Value = false end end
What did I do wrong?