|
| 15 Feb 2012 01:01 PM |
Originally, it only counted the "OCEAN Soldier" team, so I decided to make an array for the three seperate teams. Either I coded this wrong, or RBLX.Lua doesn't like me. -_-
ally = {"OCEAN Soldier","OCEAN President","Ally"} enemy = "Raider"
while true do local plrs = game.Players:getPlayers() local allies = 0 local enemies = 0 if #plrs >= 1 then for i = 1, #plrs do if plrs[i].TeamColor == game.Teams[enemy].TeamColor then enemies = enemies + 1 elseif plrs[i].TeamColor == game.Teams[ally].TeamColor then allies = allies + 1 end end end
if allies >= 2 and enemies >= 2 then print("Raid!") script.Parent.RaidStatus.Text = "Raid" script.Parent.RaidStatus.TextColor3 = Color3.new(255/255,0,0) else script.Parent.RaidStatus.Text = "No Raid" script.Parent.RaidStatus.TextColor3 = Color3.new(0,255/255,0) end script.Parent.Allies.Text = "Allies: "..allies script.Parent.Raiders.Text = "Raiders: "..enemies allies = 0 enemies = 0 wait(.5) end |
|
|
| Report Abuse |
|
|
| |
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 15 Feb 2012 02:17 PM |
The table "ally" is never used.
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 15 Feb 2012 02:25 PM |
Never mind, I skipped over it.
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 15 Feb 2012 02:26 PM |
Ally is a table that needs to be indexed, so if you wanted it to work you would do something like:
game.Teams[ally[1]]
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2012 02:51 PM |
| In this case, I would change [ally[1]] to [ally[3]]? How does that work? |
|
|
| Report Abuse |
|
|
CrasyTrex
|
  |
| Joined: 13 Mar 2011 |
| Total Posts: 761 |
|
|
| 15 Feb 2012 03:06 PM |
It is like team = {"BLUE", "ORANGE", "GREEN"} while wait() do print(team[1]) --would print BLUE print(team[2]) --would print Orange print(team[3] --would print GREEN |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2012 03:33 PM |
So, I'd apply it like this?
elseif plrs[i].TeamColor == game.Teams[ally[1]].TeamColor or game.Teams[ally[2]].TeamColor or game.Teams[ally[3]].TeamColor then |
|
|
| Report Abuse |
|
|