Well, many games have a type system you open one UI and if you have another open the other closes and I wanted to know a way to do this.
The only way I know is by checking a frame by one to see if it's open ex:
--[[ if frame2.Visible == true or frame3.Visible == true or frame4.Visible == true then
frame2.Visible = false
frame3.Visible = false
frame4.Visible = false
frame1.Visible = true
end
--]]

2 comments
You have a working script, whats the problem?
The way I would do this is making a ModuleScript that disables all of the interfaces, then enable the interface you want open with the original script.