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

How can I make a GUI that only certain people can see?

I am not an expert in scripting, so, I want to make a MOD PANEL, and I only want certain people to be able to see and click the button that opens it. How can I do that?

3 answers

place a script in the gui and write this in it

local allowedPerson = "YourNameHere"
script.Parent.Enabled = false


if script.Parent.Parent.Parent.Name == allowedPerson then
	script.Parent.Enabled = true
end

Why it's better to check with the UserId:

The UserId will always be the same whereas the Name can be changed

The solution:

local ModGui = PathToModGui
local Mods = {[InsertUserIdHere] = true, [InsertOtherUserIdHere] = true } -- A list of all mod's UserIds, needs to have = true after it or else we can't check it like this: Mods[Player.UserId]

game:GetService("Players").PlayerAdded:Connect(function(Player)
	if Mods[Player.UserId] then -- Check if Player's UserId is in the Mods dictionary
		ModGui:Clone().Parent = Player
	end
end)

The UserId is the number in the Player's profile URL i.e. https://www.roblox.com/users/`65116335`/profile for my User

Wiki:

Dictionaries

UserId

Don't forget to mark my answer as the solution and upvote it if it answered your question :)

Explanation

Define the variable for the TextButton and use MouseButton1Click() as the function as it is more reliable and I'll break down the script for you. Since for TextButtons, we primarily use MouseButton1Click as the function for clicking TextButtons. After that, we are going to check for the player's user who clicked it, if the user matches the one in our local script, then we will make the frame visible to that player only.

Filipalla's answer will work but this one is much better as I've explained how the scripts will work and the script itself is easier to write.

Solution

Now you want to add a local script into the ScreenGui and the local script would be as follows;

local textButton = script.Parent:WaitForChild("TextButton") -- Defines the variable for the TextButton

textButton.MouseButton1Click:Connect(function() -- Function for clicking
		if game.Players.LocalPlayer.Name == "SilentsReplacement" then -- Add the name of the player here!
			script.Parent.Frame.Visible = true -- Makes the frame visible
		end
end)

I hope this helps you and please up vote and select this as the answer if it did so!

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