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

How do you make a gui only visible by certain people? [closed]

Asked by 6 years ago

Okay, I have been attempting this a multitude of times but it never works does anyone know what I am doing wrong I write a script that checks the name of the players and if they are added to the script they will see the gui if not I have it set to disable it. But it don't do nothin.

1
Post your script Ultimate_Piccolo 201 — 6y
0
Is your display on your computer or ROBLOX's servers? Please answer ASAP hiimgoodpack 2009 — 6y

Closed as Not Constructive by Goulstem

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?

2 answers

Log in to vote
0
Answered by 6 years ago

The following is a script in workspace, which fires when a player joins the game. If the name of the player that joins the game is in the list of names in the table, the gui inside the player's playergui will be set to enabled.

Just make sure that you have your gui in startergui, so that it will be copied to player's playergui when they join. Also make sure that the name of said gui is "ScreenGui", and that enabled is set to false for that gui.

game.Players.PlayerAdded:connect(function(player)
    print("A player has entered: " .. player.Name)
    local list = {"123marble","yoyoy","Player"} -- Change these names to the people you want to be able to see the gui
    for i, v in pairs(list) do
        if v == player.Name then
            player.PlayerGui:WaitForChild("ScreenGui")
            player.PlayerGui.ScreenGui.Enabled = true
        end
    end
end)

if this helped plz accept answer, and if you have any questions feel free to ask.

Ad
Log in to vote
0
Answered by
Master_JJ 229 Moderation Voter
6 years ago

I haven't tested this so I am not sure if it will work but try this

Change the condition inside the if then statement to whatever condition you want.

...
local player = game.Players.LocalPlayer
if player.Name = "Player" then
    gui.Visible = true
end
...
0
Nice, but that if statement should have another = sign. Also the property for the gui itself is "enabled", Frames have the "visible" property. 123marble 61 — 6y