Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GUI only certain people can see?

How would I make a script that only allows certain people to able to see a GUI?

1 comment

0

idk what kind of GUI you want, but if you want a SurfaceGui, then make the SurfaceGui and put it inside of StarterGui. Then make a script to set the SurfaceGui's Adornee to the part you want it on

2 answers

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

This discussion is preserved as it was. New answers, comments, and votes are closed.