I Need Help Making An Active Window System for UI

So I already have a window/tab system up and its pretty good but I need a lil help making the active windows things, ive tried a few ways including GetGuiAtPositions as well as making my own Module script with 2 arrays, one being tabID’s and active ID’s it was working for a little but it turned out to be a lot harder to work with, im not too sure what to do know usually I would get lucky with the conditions and move on but i’m not sure how to deal with this. course theres always the option of going +1 on the Zindex every time, but ion wanna do that. I need someone to think of a way around this, btw the mousebutton1clicks are made by a Frame not a GUI Object, if yall got any ideas please help

The easiest way would be using Zindex, which I know you don’t want to use, but not sure of any workarounds it’s the most efficient way to get the effect you’re looking for.

Thats not what I mean by not using Zindex. When I stated using Z index I was reffering to the method of getting the number of tabs open and +1 to make it at the top, which would end up with a large ZIndex number

It needs to be something more like this, at least I would think:
[Tab1, Tab2, Tab3]
Clicks Tab2
[Tab1, Tab3, Tab2]
and update all the tabs.
Well I have done this but I run into several issues:

  • Overlapping tabs will switch between them even when I am still clicking on the top tab
  • Tabs do not register me clicking

Then I tried a different method. I assigned TabID’s and repeated the same proccess of [ Tab1, Tab3, Tab2 ], however this time I created function that will check if the mouse is in range of a tab and if so it will add to another array.
Clicks overlapping tabs
[Tab 2, Tab 1]
And I created another List and ran through the Active tab list and used a table.find to append to the end of that list to have them ordered by Active List.
[Tab 1, Tab 2]
This is where the issue begins, I have each Tab that had the mouse in range and ordered the tabs correctly, however comes the problem of conditions. Ive tried If the end of the list isnt the Top Active tab, Then switch places. Ive tried if table is 1 index long and equal to TabID, then switch places. In either cases and several other I cannot seem to get the conditions correct.

I got it down ill post images and a lil explanation for other people looking for this.



Second image is inside of a module script.

What it does:
Each tab is given a Tab ID, a simple number based on how many other tabs there is,
[1, 2, 3, 4, 5]
And another table that stores the object value for each one in consecutive order.
[obj1, obj2, obj3, obj4, obj5]
And finally a table assigned to the specific order of the UI elements, when it is first loaded it is the same as the Tab IDs
[1, 2, 3, 4, 5]

Each Tab has a Mouse Click Listener, when it is clicked it sends a mouseList function to the module, this function takes in the Mouse.X position and the Mouse.Y position. It then iterates through the Object List, and if that object is within the Mouses position it will append the count number to the temp List, since the objects are in chronological order it works perfectly.

Now when this temp List is returned it may appear as one value sometimes (not sure y), anyways we persist, Next we check if the TOP current active layer is not included in that mouse List, we do this to detect a different active tab change. Second to last, we make this Tab ID the new Top dog, and remove him from the list and add him to the front.

Finally we fire a bindable event and it sends to all Tabs to update their ZIndex’s. And botta bing botta boom idk why this was so hard for me.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.