| |
|
»
»
|
|
| |
Re: Button not working first time -
|
|
|
|
| 23 Sep 2014 12:32 PM |
I'm clicking on my gui imagebutton the first time, and it doesn't do anything. I click it a second time, and the script runs. Why doesn't it do it the first time?
menu = script.Parent.Parent.MenuFrame
function open() menu.Visible = true on = true menu.Profile:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Inventory:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.BuyPoints:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Uniform:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) on = false end
function close() on = true menu.Profile:TweenPosition(UDim2.new(-1,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Inventory:TweenPosition(UDim2.new(1,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.BuyPoints:TweenPosition(UDim2.new(-1,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Uniform:TweenPosition(UDim2.new(1,0,0,0),"Out","Bounce",1,true) wait(1) menu.Visible = false on = false end
script.Parent.MouseButton1Click:connect(function() if menu.Visible == false and on == false then open() elseif menu.Visible == true and on == false then close() end end)
"Et tu, Brute? Then fall, Caesar." - Julius Caesar |
|
|
| Report Abuse |
|
|
SirNoobly
|
  |
| Joined: 01 Oct 2009 |
| Total Posts: 253 |
|
|
| 23 Sep 2014 12:43 PM |
Set the menu to not Visible. In the properties.
I think. |
|
|
| Report Abuse |
|
|
PlumJar
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 907 |
|
|
| 23 Sep 2014 12:55 PM |
No
menu = script.Parent.Parent.MenuFrame
function open() menu.Visible = true on = true menu.Profile:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Inventory:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.BuyPoints:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Uniform:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) on = false end
function close() on = true menu.Profile:TweenPosition(UDim2.new(-1,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Inventory:TweenPosition(UDim2.new(1,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.BuyPoints:TweenPosition(UDim2.new(-1,0,0,0),"Out","Bounce",1,true) wait(0.5) menu.Uniform:TweenPosition(UDim2.new(1,0,0,0),"Out","Bounce",1,true) wait(1) menu.Visible = false on = false end
on = false ------this i think
script.Parent.MouseButton1Click:connect(function() if menu.Visible == false and on == false then open() elseif menu.Visible == true and on == false then close() end end) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 23 Sep 2014 01:01 PM |
| It's your default for on, I'm sure. |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2014 01:11 PM |
Oh, I forgot to post the on variable
right below menu is this on = false
"Et tu, Brute? Then fall, Caesar." - Julius Caesar |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
| |
|
|
| 23 Sep 2014 01:21 PM |
False
"Et tu, Brute? Then fall, Caesar." - Julius Caesar |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2014 01:23 PM |
Wait, it was true.. ugh. Thanks. I'm so stupid, lol
"Et tu, Brute? Then fall, Caesar." - Julius Caesar |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2014 01:28 PM |
| Script has to be a localscript you can only tween in localscripts. |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2014 01:29 PM |
@Vince
Wrong. Wiki is outdated on that part. You can tween in normal scripts. Try it.
"Et tu, Brute? Then fall, Caesar." - Julius Caesar |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2014 01:33 PM |
I know but for along time there roblox broke it and I guess they finally fixed it. :P Gimmie a min i'll clean your code up. :3 |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2014 01:37 PM |
--You may have to change some things I just edited the first code you posted. :P
menu = script.Parent.Parent.MenuFrame
function open() menu.Visible = true on = true for i=1, 4 do menu.Profile:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",1,true) wait(0.5) end on = false end
function close() on = true for i=1, 4 do menu.Profile:TweenPosition(UDim2.new(-1,0,0,0),"Out","Bounce",1,true) wait(0.5) end wait(0.5) menu.Visible = false on = false end
on = false
script.Parent.MouseButton1Click:connect(function() if menu.Visible == false and on == false then open() elseif menu.Visible == true and on == false then close() end end) |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2014 01:39 PM |
Ohh.. >_> Just noticed there all something diff. XD |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
| |
|
PlumJar
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 907 |
|
|
| 24 Sep 2014 08:55 AM |
so was i right or what? ;3
Mewo. |
|
|
| Report Abuse |
|
|
|
| 24 Sep 2014 09:00 AM |
@Plum You weren't right, I already had the on variable defined as false. The problem was that the frame's visibility was true to begin with, making the scripting requiring you to click twice to make it appear to work the first time.
"Et tu, Brute? Then fall, Caesar." - Julius Caesar |
|
|
| Report Abuse |
|
|
PlumJar
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 907 |
|
|
| 24 Sep 2014 09:02 AM |
Oh ok, well im glad you were able to fix your prob.
Mewo. |
|
|
| Report Abuse |
|
|
|
| 24 Sep 2014 09:03 AM |
Yeah, but if you want, I need help fixing my data store script. :[
"Et tu, Brute? Then fall, Caesar." - Julius Caesar |
|
|
| Report Abuse |
|
|
|
| |
|
|
| |
|
»
»
|
|
|
|
|