alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 24 Jul 2014 01:19 PM |
| Is there a way to know if the GUI has finished tweening the position? |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Jul 2014 01:21 PM |
You could check if the gui's position is about (because it's not perfectly transition) the end position of the tween. You could also just use wait (timeyouselectedtomakethetransitition)
-I just hit 4k posts, made a lengthy speech lol: http://www.roblox.com/Forum/ShowPost.aspx?PostID=141338105- |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 24 Jul 2014 01:23 PM |
| Alright thanks, Ill just use wait() since Im using a bounce style |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Jul 2014 01:24 PM |
| Usually 1 second by default, but if you put a custom time argument just wait that time. |
|
|
| Report Abuse |
|
|
GollyGreg
|
  |
| Joined: 22 May 2008 |
| Total Posts: 21835 |
|
|
| 24 Jul 2014 01:27 PM |
The final argument is a callback function.
So for example:
Frame:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Out", "Linear", 0.125, true, function() print("The tweening is done") --or a boolean if you prefer or just continue the rest of the thread here end) |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 24 Jul 2014 01:29 PM |
Yea, I got it, I had a variable for the time interval, so I just used that. But I have another problem, IF you call the function while its still in use, the GUI gets stuck there, I tried a way around, heres my script:
function notify(txt,who,style,interval,interval2) plr = game.Players:FindFirstChild(who) print("Starting...") if plr~=nil then print("Player found!") gui = plr.PlayerGui:findFirstChild("Notify") if gui~=nil then print("Gui found!") iu = gui.Main.InUse if iu.Value == false then print("Not in use!") iu.Value = true gui.Main.Button.Text = txt.."!" gui.Main:TweenPosition(UDim2.new(0.25,0,0.3,0),"Out",style,interval,false) wait(interval2) gui.Main:TweenPosition(UDim2.new(0.25,0,-0.3,0),"In",style,interval,false) wait(interval) iu.Value = false elseif iu.Value == true then print("In use, waiting..") repeat wait(1) until iu.Value == false iu.Value = true gui.Main.Button.Text = txt.."!" gui.Main:TweenPosition(UDim2.new(0.25,0,0.3,0),"Out",style,interval,false) wait(interval2) gui.Main:TweenPosition(UDim2.new(0.25,0,-0.3,0),"In",style,interval,false) wait(interval) iu.Value = false end print("Done!") end end end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Jul 2014 01:49 PM |
| How is the callback handled if the override is true? |
|
|
| Report Abuse |
|
|
GollyGreg
|
  |
| Joined: 22 May 2008 |
| Total Posts: 21835 |
|
|
| 24 Jul 2014 01:51 PM |
cntkillme
I dont think it runs the function if its interrupted. Can't remember. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Jul 2014 02:07 PM |
| Hopefully it doesn't, or at least the first upvalue of the callback function would be whether it finished or not. |
|
|
| Report Abuse |
|
|