How to fix overlapping GUI

Sorry if I’m bad at explaining this but:
I’ve been testing this simulator game and I found something that I need help with.
On the left side of the screen, there are two buttons for a Trail Store and a normal Store.
When I press Trail Store, the GUI pops up as it should.
But then, if I press “Store” after pressing “Trail Store” initially, these two GUI’s overlap.


How do I make it so when I press “Store” when “Trail Store” pop-up is open, the “Trail Store” pop-up closes and the “Store” pop-up appears?

1 Like

When you open the Store frame in a script, set the Trail Store’s visible false to false. Then when you close the store, change the Trail Store’s visible value to true.

button.MouseButton1Click:Connect(function()
  if script.Parent.Store.Visible == false then
    script.Parent.Store.Visible = true
    script.Parent.Trails.Visible = false
  else
    script.Parent.Store.Visible = false
    script.Parent.Trails.Visible = true
  end
end)
2 Likes

UIGridLayout wouldn’t help here. The issue isn’t that the buttons themselves are in a bad layout, it’s that two different store windows are open at the same time rather than one over the other. If it’s just one or two Guis, something like the above would suffice. For multiple, tracking the current open window or doing a bit of iteration work would be required.