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.
How do you make a gui only visible by certain people?
2 answers
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.
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
...
1 comment
Nice, but that if statement should have another = sign. Also the property for the gui itself is "enabled", Frames have the "visible" property.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Post your script
Is your display on your computer or ROBLOX's servers? Please answer ASAP