I have been trying to figure out a way to have nested functions in my script. I need both gui1 and gui2 to make gui3 visible when they click the button on each and then I need it to connect to the function when the player clicks on gui3. The problem I am having is if the player clicks gui1, then gui3, then gui2, clicking gui3 again would cause both events within the functions to fire and print both options at the same time. I need to figure out a way to fix this and the only way that I can think of is debounce. I just wanted to know if there was an easier way.
This is the code that I have so far and it does what is described above.
gui1.MouseButton1Down:connect(function()
gui3.Visible = true
gui3.MouseButton1Down:connect(function()
print("Option1")
gui3.Visible = false
end)
end)
gui2.MouseButton1Down:connect(function()
gui3.Visible = true
gui3.MouseButton1Down:connect(function()
print("Option2")
gui3.Visible = false
end)
end)
