How would you make a variable so when a button is clicked again it does a function?

I am still learning to become a better roblox UI builder, and I have tried doing this before but normally it wouldn’t function and I have to use while true do to make it work, so I am wondering how you would do this in a better way?

2 Likes

I think you are talking about the clicking function.

guiObject.MouseButton1Click:Connect(function() --Change the guiObject to your Button
--Stuff you want it to do
end)

In addition I believe that It should’ve been in Scripting Support. Thank you and good luck on your future projects. :grinning:

Hello Microsoft_Net!
I think I understand your problem! :smile:
Anyways, I made a model and a example game for you!
It uses the Disabled function in scripts! It’s easy once you understand it!
Game: https://www.roblox.com/games/3388554708/Help-for-Microsoft-Net
(The game is not copy-locked, so you can edit it and look at the scripts.)

Model: https://www.roblox.com/library/3388741808/Help-for-Microsoft-Net

Please let me know if I helped you! :smile:

Oh i’m okay now, I just forgot about elseif statements, I posted this about a month ago and I forgot to mark it as solved, I appreciate your help and the effort you put in your answer, it really makes it more easier to understand. :smile:

(I’m still trying to get better at english though :smile:)

1 Like