Script Button Active Not Functioning Properly

I want the button to not be active while the tween is playing so it cannot glitch the GUI.

The issue is that even when I make the bool of active false, it still clicks so I’m not sure if it is a roblox problem.

I tried asking others on various developer discord groups and had no answers to this.
I’m hoping it is an easy fix so I don’t have to provide more but the mean problem is the active being false and the button still clicking and the function is working.

If anyone knows why I will be grateful, thank you.


GuiButton.Active doesn’t prevent things like click or input events from firing for the GuiButton.

It looks like you want a Debounce


To support what @NPh_rd says, you likely need a debounce in this case, as it allows you to implement code that runs completely before it is called to run again.

local Debounce = false

   if Debounce then
      print("Code is currently running. Try again later!")
   Debounce = true

   -- your code here

   Debounce = false

Wouldn’t you need to use an else statement?

Yeah, you can add an else statement if you want but either way it would work still because when the button clicks it will check if debounce is false then sets debounce to true and actual code runs.

But add an else statement, I would add the else statement as well and that is why it exists.

1 Like

Alright and I know how return works but why would it be necessary in this case? Why can’t I just end it? It will still give me the print.