Hello Devs, I have a small question for you. I am currently working on a “hangout” game (something I never thought I would try to make but here I am) and need help with a certain script. As you probably have read the title, I am trying to make an “Input Song ID” GUI that only certain people (mods or admin) can use and input a song ID. How can I make the GUI so where only selected people can access and view it? I hope this was detailed enough for it to make sense.
p.s. I’m going to bed soon so I won’t respond for the next 6-8 hours (no school tomorrow!)
Hey,
you can simply achieve it by storing your ‘AdminGui’ in ServerStorage and make table of UserIds for admins that will get cloned version of this to their playergui.
You can put the ScreenGui for your Input Song thing somewhere such as ServerStorage and make it so when a player joins, it checks something, such as a table of the UserIds considered as Admins on the UserId of the player who joined and clone that ScreenGui into their PlayerGui
@caviarbro had already stated that before me but to explain it a bit more, here’s an example assuming SongGui is a ScreenGui in ServerStorage
--Services
local players = game:GetService("Players")
local servStorage = game:GetService("ServerStorage")
local songGui = servStorage.SongGui
--Admin Ids
local ids = {
1745848,
1526373,
63859378,
--Add more if needed
}
--Detect when a player joins
players.PlayerAdded:Connect(function(player)
local plrGui = player:WaitForChild("PlayerGui")
if table.find(ids,player.UserId) then --Is UserId in table?
songGui:Clone().Parent = plrGui --Clone Gui into player
end
end)
I didn’t make a variable for the cloned Gui since all we’re doing here is setting a single properyy (the Parent property), but if you have to change 2 or more, such as the Enabled Property and the Parent Property, you will have to put songGui:Clone() into a variable and reference that.
I believe the ScreenGui should have ResetOnSpawn disabled so it persists on respawn as well
So I have the “ScreenGUI” (with a image label to test) in Server Storage and one LocalScript (with your code). And yet after I press play, the ScreenGUI does not pop up on my screen and nothing is shown in the Output.
(sorry if I’m bothering you with this, I really need this to finish this by tomorrow)