Disabling Buttons

Good Day devs!

I’ve been trying an efficient way of disabling a button. I’ve Tried Using A boolean Value, Selectable and active. I have no actual idea on making it better. Please Be light with me, I’m still fairly new.

1 Like

You can just disable the script

6 Likes

@VortexD3V Im trying to make them in one script to be more clean.

If I understand correctly, you can place a bool value inside the button (you could call it Disabled) that you want to disable. Then, when the button is clicked you just check if [Disabled.Value == false then] just put your code of what you want the button to do. It will check if the the value is false and if its not disabled, your code inside will run however if it IS disabled, nothing will happen.

9 Likes

@ScriptedBinary As i said, I was trying to find an efficient way to disabling it.

Is using a bool value not an efficient way? :confused:

I am not sure what you are talking about?
But instead of a boolean try a variable?

No, I meant Is there any other way that is more efficient? Im sorry if this confused you.

Another way I can think if is just to delete/editout the MouseButton1Click function. That way, nothing will happen if you click the button

1 Like

I think i get it now? :thinking:

So you are trying to disable the page when you click on another page.

make a variable

local currentPage

Now whenever you click on a button to set the page turn the visiblility on the curret page to off then set the new page to visible

--event
currentPage.Visible = false
newPage.Visible = true
currentPage = newPage
--end

Note: newPage = the page you want to set it to

Yes, this could work, as an alternative.

Alright, Thanks @ScriptedBinary!