|
| 26 Oct 2015 04:29 PM |
I need help with editing a script that determines which team wins the game. Here it is:
function countBricks(model, color1, color2) local color1count = 0 local color2count = 0
for index, child in pairs(model:GetChildren()) do if child:IsA('BasePart') then -- Check if child can have color. if child.BrickColor == color1 then color1count = color1count + 1 elseif child.BrickColor == color2 then color2count = color2count + 2 end end end
return color1count, color2count end
wait(2) script.canister:Play() wait(3) script.canister:Stop() c1 = BrickColor.new("Cyan") c2 = BrickColor.new("Pink") c1num, c2num = countBricks(workspace, c1, c2) if c1num > c2num then game.Workspace.eventboard.gui.Text.Text = "Blue Wins!" v.PlayerGui.ScreenGui.TextLabel.Text = "Blue Wins!" for _,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == "Cyan" then -- assuming winningTeam is a BrickColor value script.victory:Play() wait(4) script.victory:Stop() elseif v.TeamColor == "Pink" then script.defeat:Play() wait(6) script.defeat:Stop() end end elseif c2num == c1num then else v.PlayerGui.ScreenGui.TextLabel.Text = "Pink Wins!" ----Here is what I need help with, and below game.Workspace.eventboard.gui.Text.Text = "Pink Wins!" for _,v in pairs(game.Players:GetPlayers()) do if v.TeamColor == "Pink" then script.victory:Play() wait(4) script.victory:Stop() elseif v.TeamColor == "Cyan" then script.defeat:Play() script.defeat.TimePosition = 6 wait(6) script.defeat:Stop() end end
_______________________________________________________________________
So anyways it counts up the bricks and then the team that painted the most bricks heres the victory audio, and the losing team heres the losing audio. For some reason the audios aren't playing :( Can anyone fix this? |
|
|
| Report Abuse |
|
|
| |
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
| |
|
| |
|
| |
|
| |
|