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: If, elseif, elseif, elseif and else.

Previous Thread :: Next Thread 
Camoy is not online. Camoy
Joined: 21 May 2009
Total Posts: 6207
11 Oct 2009 05:38 PM
How do I make it so that if script.Parent.Oc# which is an NumberValue, if it is equal to 1, or 2 or 3 or 4 or 5, that for each corresponding number has a value 1 = Blah, 2 = Agh ect... Instead of doing If and then lots of elseif's, is there a smarter way?
Report Abuse
TheSquirrel is not online. TheSquirrel
Joined: 23 Aug 2008
Total Posts: 5557
11 Oct 2009 05:40 PM
Values = {
1 = "Blah",
2 = "Argh",
3 = "etc"
}
X = Values[script.Parent.Oc.Value]
Report Abuse
Camoy is not online. Camoy
Joined: 21 May 2009
Total Posts: 6207
11 Oct 2009 06:08 PM
Didn't work...
Report Abuse
JoshJosh117 is not online. JoshJosh117
Joined: 22 Jul 2007
Total Posts: 4862
11 Oct 2009 06:27 PM
Values = {"Argh","Blah","Etc"}

X = Values[script.Parent.Oc.Value]
Report Abuse
Camoy is not online. Camoy
Joined: 21 May 2009
Total Posts: 6207
11 Oct 2009 07:15 PM
-- This phailes..

Values = {"Meh","Blah","Etc"}

function onButton1Down()

x = Values[script.Parent.Parent.OcNum.Value]

print(OcNum.Value)

game.Workspace.JobCheck.Value = x

script.Parent.Parent.Visible = false


end

script.Parent.MouseButton1Down:connect(onButton1Down)
Report Abuse
JoshJosh117 is not online. JoshJosh117
Joined: 22 Jul 2007
Total Posts: 4862
11 Oct 2009 08:54 PM
First of all, output please? Second, use:

script.Parent.MouseButton1Click:connect(onButton1Down)

for the last line.
Report Abuse
TheSquirrel is not online. TheSquirrel
Joined: 23 Aug 2008
Total Posts: 5557
12 Oct 2009 12:33 AM
I am such an idiot.
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