generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Raid GUI array not working?

Previous Thread :: Next Thread 
Ilithidguard is not online. Ilithidguard
Joined: 30 Aug 2008
Total Posts: 913
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
Ilithidguard is not online. Ilithidguard
Joined: 30 Aug 2008
Total Posts: 913
15 Feb 2012 02:14 PM
Can anyone see a problem?
Report Abuse
Riderj is not online. 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 is not online. 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 is not online. 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
Ilithidguard is not online. Ilithidguard
Joined: 30 Aug 2008
Total Posts: 913
15 Feb 2012 02:51 PM
In this case, I would change [ally[1]] to [ally[3]]? How does that work?
Report Abuse
CrasyTrex is not online. 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
Ilithidguard is not online. Ilithidguard
Joined: 30 Aug 2008
Total Posts: 913
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image