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 and elseifs

Previous Thread :: Next Thread 
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
06 Sep 2013 11:36 PM
function clicky()
if game.Workpsace.Gate.gate.Transparancy == 0.2 then
game.Workpsace.Gate.gate.Transparancy = 0.18

elseif game.Workpsace.Gate.gate.Transparancy == 0.18 then
game.Workpsace.Gate.gate.Transparancy = 0.2
end
end

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

And this is the output:

21:36:24.665 - function clicky()
if game.Workpsace.Gate.gate.Transparancy:10: attempt to index global 'script' (a nil value)
21:36:24.668 - Script 'function clicky()
if game.Workpsace.Gate.gate.Transparancy', Line 10
21:36:24.669 - stack end
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
06 Sep 2013 11:39 PM
b1
Report Abuse
canada1232111 is not online. canada1232111
Joined: 16 Jan 2013
Total Posts: 863
06 Sep 2013 11:39 PM
function clicky(
if game.Workpsace.Gate.gate.Transparancy = 0.2 then
game.Workpsace.Gate.gate.Transparancy = 0.18

elseif game.Workpsace.Gate.gate.Transparancy = 0.18 then
game.Workpsace.Gate.gate.Transparancy = 0.2
end
end)

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


ehh might work idk. too lazy to check ._.
Report Abuse
canada1232111 is not online. canada1232111
Joined: 16 Jan 2013
Total Posts: 863
06 Sep 2013 11:42 PM
Wait.. I think I just sorta confused rbx.Lua with php o.e


derp..


well one thing is for sure, you have the ='s wrong.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Sep 2013 11:46 PM
if statement == condition then
elseif statement == condition then
else
end

"elseif code" is equivalent to "else if code end" but it much faster.
Report Abuse
canada1232111 is not online. canada1232111
Joined: 16 Jan 2013
Total Posts: 863
06 Sep 2013 11:48 PM
omfg nvm, I really need to go to sleep, I'm getting retarted.
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
06 Sep 2013 11:54 PM
@cnt what do you mean.
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
06 Sep 2013 11:56 PM
e = 0

function clicky()
if e == 0 then
game.Workpsace.Gate.gate.Transparancy = 0.18
e = 1
else if e == 1 then
game.Workpsace.Gate.gate.Transparancy = 0.2
e = 0
end
end
end

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



--@Jd678_RBLX
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
07 Sep 2013 12:01 AM
Jd that doesn't work either.
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
07 Sep 2013 12:13 AM
b2
Report Abuse
Excellus is not online. Excellus
Joined: 17 Jun 2013
Total Posts: 3939
07 Sep 2013 12:18 AM
you spelled "Transparency" wrong.
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
07 Sep 2013 12:23 AM
I did o.e or did JD spell it wrong?
Report Abuse
canada1232111 is not online. canada1232111
Joined: 16 Jan 2013
Total Posts: 863
07 Sep 2013 12:24 AM
you did noc, jd and me got it wrong because we copied "Transparancy" from you.
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
07 Sep 2013 02:35 AM
oh, yeah I just copied your script and edited it.

Didn't even notice the spelling



--@Jd678_RBLX
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Sep 2013 10:55 AM
JD you are missing an end.
Add an end or remove the space between else and if
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