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 » Scripters
Home Search
 

Re: Help with "else" script thingy

Previous Thread :: Next Thread 
minerioProgramer is not online. minerioProgramer
Joined: 21 Dec 2012
Total Posts: 432
02 Jan 2016 06:48 PM
So EVERY time I make a script that has "else" in it, it doesn't work, and It is probably because I am using it in the wrong way, let me show you how I type it:

function onClicked()
if tonumber(script.Parent.Parent.Parent.Open.Value) == false then
script.Parent.Parent.Parent.Open.Value = true
else
script.Parent.Parent.Parent.Open.Value = false
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

When I click, the "Open" value gets set to true, but then when I click it again, it doesn't turn back! Can someone teach me how to properly use the else function?

Sorry, I am a new scripter!
Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 06:49 PM
Try using elseif
Report Abuse
minerioProgramer is not online. minerioProgramer
Joined: 21 Dec 2012
Total Posts: 432
02 Jan 2016 06:50 PM
How do I use "elseif"?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
02 Jan 2016 06:52 PM
Don't listen to Lice, he doesn't know what he's talking about. Don't use elseif here, it is uselessly being inefficient.


function onClicked()
if script.Parent.Parent.Parent.Open.Value == false then
script.Parent.Parent.Parent.Open.Value = true
else
script.Parent.Parent.Parent.Open.Value = false
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)




Also, you might try this

function onClicked()
script.Parent.Parent.Parent.Open.Value = not script.Parent.Parent.Parent.Open.Value
end

Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 06:52 PM
Well...

Say I bad a condition:
If x == 5 then
print ("uo")
elseif x == 20 then
print ("awye")



Make x 20 and see what happens.
Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 06:53 PM
Jarod can't script >_>
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
02 Jan 2016 06:54 PM
How does elseif help here? That makes it less efficient while doing the same thing.
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
02 Jan 2016 06:54 PM
Lice, obviously you would use elseif in that condition, but If you would actually read OP's thread, you would realise an elseif would be useless, because he is checking for true or false.


#code --jmt99
Report Abuse
triode is not online. triode
Joined: 13 Aug 2011
Total Posts: 5844
02 Jan 2016 06:55 PM
elseif is good for bools...

Its not good for anything else unless you use an else
Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 06:55 PM
Lies
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
02 Jan 2016 06:55 PM
OP seems to be checking a boolean value, else is fine :p
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
02 Jan 2016 06:55 PM
"Lies"
Lice?
Report Abuse
triode is not online. triode
Joined: 13 Aug 2011
Total Posts: 5844
02 Jan 2016 06:55 PM
Wait nvm...


I c what happened lmao
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
02 Jan 2016 06:56 PM
>elseif is good for bools...

How so? There is only 2 values in which a boolean can be. True or false. So therefor, you only need to check if its true or false, and then put an ELSE statement, which would result in the other boolean.


#code --jmt99
Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 06:56 PM
Jarod is a fat pig
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
02 Jan 2016 06:57 PM
bAIT
BaIT
BAiT
BAIt
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
02 Jan 2016 06:58 PM
Did I upset someone?
Report Abuse
jmt99 is not online. jmt99
Joined: 27 Jul 2008
Total Posts: 4799
02 Jan 2016 06:58 PM
Lice you're very ignorant.


#code --jmt99
Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 06:59 PM
Your mom is very ignorant


She was suxin my d and she was being ignorant not to swallow
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
02 Jan 2016 07:00 PM
lmao
get destroyed
Report Abuse
iPenguinSuperTime is not online. iPenguinSuperTime
Joined: 25 Apr 2012
Total Posts: 3757
02 Jan 2016 07:00 PM
@lice

wiki.roblox.com
>tutorials
>scripting
Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 07:01 PM
@iPenguin

idiot.com
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
02 Jan 2016 07:08 PM
Definitely trolling at this point.
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
02 Jan 2016 07:10 PM
meto calm down :/


Report Abuse
LicePro is not online. LicePro
Joined: 08 Dec 2015
Total Posts: 467
02 Jan 2016 07:40 PM
Btch pleeeezeee
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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