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
 

Smart Spawn Script 'if' & 'elseif'

Previous Thread :: Next Thread 
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
06 Jul 2011 07:28 PM
--So far this is what I've created, this one was my first try but didnt work and no mistakes that were said in the output.

game.Players.PlayerAdded:connect(function(newPlayer)
if game.Teams["Doom King"].Players.Value==0 and game.Teams["King"].Players.Value==0 or game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==0 then
newPlayer.TeamColor=BrickColor.new("New Yeller")
elseif game.Teams["Doom King"].Players.Value==0 and game.Teams["King"].Players.Value==1 then
newPlayer.TeamColor=BrickColor.new("Really red")
elseif game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==1 and game.Teams["Doom Knight"].Players.Value<=game.Teams["Pactagonal Knight"].Players.Value then
newPlayer.TeamColor=BrickColor.new("Bright red")
elseif game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==1 and game.Teams["Doom Knight"].Players.Value>=game.Teams["Pactagonal Knight"].Players.Value or game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==1 and game.Teams["Doom Knight"].Players.Value==game.Teams["Pactagonal Knight"].Players.Value then
newPlayer.TeamColor=BrickColor.new("Bright yellow")
end
end)

--Second try but didn't work too.

game.Players.PlayerAdded:connect(function(newPlayer)
if game.Teams["Doom King"].Players.Value==0 and game.Teams["King"].Players.Value==0 or game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==0 then
newPlayer.TeamColor=BrickColor.new("New Yeller")
end
if game.Teams["Doom King"].Players.Value==0 and game.Teams["King"].Players.Value==1 then
newPlayer.TeamColor=BrickColor.new("Really red")
end
if game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==1 and game.Teams["Doom Knight"].Players.Value<=game.Teams["Pactagonal Knight"].Players.Value then
newPlayer.TeamColor=BrickColor.new("Bright red")
end
if game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==1 and game.Teams["Doom Knight"].Players.Value>=game.Teams["Pactagonal Knight"].Players.Value or game.Teams["Doom King"].Players.Value==1 and game.Teams["King"].Players.Value==1 and game.Teams["Doom Knight"].Players.Value==game.Teams["Pactagonal Knight"].Players.Value then
newPlayer.TeamColor=BrickColor.new("Bright yellow")
end
end)
Report Abuse
Shobobo99 is not online. Shobobo99
Joined: 30 Dec 2008
Total Posts: 5754
06 Jul 2011 07:30 PM
Have you ever heard of using variables to shorten up things?
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
06 Jul 2011 07:31 PM
Well, if that's going to fix the script then I'll do that.
Report Abuse
Shobobo99 is not online. Shobobo99
Joined: 30 Dec 2008
Total Posts: 5754
07 Jul 2011 03:06 PM
It just makes it easier to erad and that way we can find the problem easier.
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