I am trying to make a 3d ui for my game using SurfaceGuis. One of the features is a scrolling frame that shows all units you own + a viewport frame showing their model, as shown below:
The first issue I encountered was the fact that viewport frames can only work inside surface guis if the latter is inside the player/starterGui folder. I then changed my system to fix that, making use of the Adornee property to render the ui where it should. However, that proved to be a problem, as (even though everything is set up correctly in the code) the surface gui doesn’t render, as shown:
Experimenting during runtime (as the ui is made through code), I discovered that by disabling and enabling the surface gui, or by swapping the Adornee back and forth between two parts (essentially just forcing it to render again, I believe), the gui renders normally as it should (using the explorer and properties tabs, which is how I got the first picture). No other properties were changed, what leads me to believe this is some sort of issue or bug (as I am unable to replicate the previously mentioned runtime explorer strategies in code).
Has anyone experienced this before? Is there some obvious problem that I am missing?
Note: I didn’t post any code because I believe the issue is not related to it, it is just a local script that makes a SurfaceGui, parents it to the PlayerGui folder and sets the face to Front; all the actual pieces of UI are added later and just parented to it so there should not be any problem here.
Not sure if, but I thought that if you create something within a local script, it cannot be used by the server. As the UI wants to be shown on a part in the server, it cannot do that as it is only created for the client.
Please tell me if i’m wrong here, but i hope i could help you out a bit.
This is all inside a local system. The server sends a remote containing all the player data, and from there on everything is made in the client, from the guis to the parts they’re on
I did some reading, and someone said that when too much happens with the GUI, it can crash and not display. His solution to this was to clone the GUI and use that one instead, so you are using a ‘fresh’ GUI. If this doesn’t work then I wouldn’t know what to do except for disabling and enabling it with a script, so it does render as you said before.
Before I realized the viewport frame problem (when the surfaceGui was just inside a part normally) all the UI rendered fine, the “not rendering” issue started when I moved it to the playerGui folder and started using the Adornee property. Setting it in a script seemingly does nothing, it only changes when being set manually on studio. I’ve tried disabling it and enabling it with a script, as well as changing the Adornee back and forth (as those were the solutions that worked during runtime on studio) but to no avail.
Is it maybe possible to use Replicated Storage instead of Player Gui then? That enables the GUI to be accessed from both client and server. This might make it vunerable to hackers, though. As they can access all the items that are available to the client. I don’t know if would be progressfull to hack a GUI though, so you could give it a shot.
The system is secure, the client just receives a mirror of their data (which is kept on the server at all times). The server has no need to meddle with any ui, it simply just sends said mirror to the client whenever the data changes. The surface gui needs to be on the playerGui folder or else the viewport frames inside it won’t render their respective models (and thus there will be no unit inside the icons).
Ah okay, I didn’t know that, thanks. I’m quite new to Roblox Studio, so I don’t know alot about everything yet. I absolutely have no clue what it could be at this point, so if there’s a way to contact Roblox themselves, I suggest you do, as you make no progress like this.
Good luck with your project!
I’ll try that, thank you for your efforts anyways