How would I make a script that only allows certain people to able to see a GUI?
The way GUIs work is that each player has their own PlayerGui
inside their Player object, and they can only see GUIs inside that PlayerGui. When they join the game, anything inside the StarterGui is copied automatically into the player's PlayerGui.
To answer your question, the easiest way to do this is to make a GUI in the StarterGui with Visible
set to false, then make a script that sets it to true if the person should be able to see the GUI.
For example, if I only wanted myself to be able to see the GUI and the GUI was called MyFrame
, I would do this:
-- This is only a small example. The script won't work with FilteringEnabled. game.Players.PlayerAdded:connect(function(player) -- In practice, UserId is preferred, but for this example I use Name. if player.Name == "IDidMakeThat" then player.PlayerGui.ScreenGui.MyFrame.Visible = true end end)
Hopefully this will allow you to figure out how to achieve this in your specific case.
Maybye you should use Instance.new() to make a gui in game.Players.USERNAMEHERE?.PlayerGui