Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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?

Closed as Not Constructive by hiimgoodpack and killerbrenden

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

3 answers

Log in to vote
0
Answered by 4 years ago

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
Ad
Log in to vote
0
Answered by
Filipalla 504 Moderation Voter
4 years ago
Edited 4 years ago

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 :)

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!