Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to stop a function if an event is fired until a countdown finishes?

Asked by
Aimarekin 345 Moderation Voter
6 years ago
Edited 6 years ago

Okay, the title is sure very confusing.

The thing is, I have a function that is connected to the Event event of a BindableEvent, for instance.

The Event fires whenever the gui is interacted with.

The function hides the gui if it is not interacted with for a set amount of time.

Now, this function doesn't run if it is already running,

but I'd like to know how to do that, the script waits 3 seconds. If in those 3 seconds the gui is intercated with, the function stops running doing nothing. If in those 3 seconds the BindableEvent doesn't get fired, the gui will hide.

Now, how would I make this function stop running if It's in that 3 second loop whenever that Event Event is fired?

Help is appreciated! Thanks!

I am not requesting code, but seeking for help on how to achieve this.

0
this is very vague, what kind of guiobject are we working with here? tantec 305 — 6y
0
I'm working with BindableEvents, not guiobjects. As I said, I've got a BindabelEvent tht fires when the gui is used. Aimarekin 345 — 6y
0
no, i mean what kind of guiobject are you interacting with, (textbox, textbutton, textlabel, frame) ??? tantec 305 — 6y
0
A frame, but that doesn't have much related to the question or how to solve it Aimarekin 345 — 6y
View all comments (2 more)
0
debounce? awesomeipod 607 — 6y
0
Not at all. Nothing related with debounce here. Aimarekin 345 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

I think returnig 'end' will do:

if script.Parent.MouseButton1Click then return end

0
Uhhh that's not even what I was asking for. Aimarekin 345 — 6y
0
You can't return end by the way. An end is not returned. It determines where do things end. Aimarekin 345 — 6y
0
what User#19524 175 — 6y
Ad

Answer this question