I’m trying to parent an Admin Panel UI that I made to the PlayerGui if the player is a high enough rank in the group. However, it won’t parent for some reason.
if player:GetRankInGroup(Settings.GroupId) >= Settings.RequiredRank then
local a = game:GetService("ServerStorage").AdminPanel:Clone()
a.Parent = player.PlayerGui
a.Enabled = true
This is the PlayerGui after parenting:
As you can see, no “AdminPanel”.
I have no idea why this is happening. Any help is appreciated.
EDIT: I have tested this with printing, and it prints that I’m a high enough rank. However, the UI does not appear
You can’t access ServerStorage on client because the Server services are locked to the client. Use ReplicatedStorage instead
I’m doing this on the server, not the client.
You can’t access PlayerGui on the server.
That is where you are wrong. I have done something like this for a gamepass before, and it worked fine. I was able to parent a UI to the PlayerGui from the server no problem, but for some reason this time it isn’t working
(Just realised that you can)
Using the server to access gui is already bad practice. I’d rather you either send a remote event to the client or use the client for the whole thing instead.
I did this exact thing for a game of mine and it’s worked pretty well. I haven’t heard of any exploiting of the system either.
Here's what worked:
Just keep the admin GUI inside the StarterGui then have a script on your client check if the LocalPlayer should have the admin gui ever visible, and if so then enable it otherwise just delete it.
And of course, make sure the remote event that is fired to tell the server what admin commands/features are being executed is sanity checked. This would be ideally done with the same checks that were done on the client.
This leads any cheaters, who somehow got the menu to stay visible before your client script deletes it, to not able to execute any admin features, only see the menu.
Hope that helps!
ServerStorage cannot be accessed by the client, I would put it in ReplicatedStorage!
did you check if your AdminPanel was Enabled, or its frame was Visible?