How would I make a GUI visible to only certain people

Hello, I want to make a GUI that gives a player money I already know how to script that for me it is easy but I dont know how to make it visible to only certain people I tried but failed in the end I hope someone can help because I really dont understand this.

1 Like

Well, I am more of a builder than a scripter, but first what parameters do you want the gui to apply to the certain person? If I’m not clear enough what I mean is, do you want the gui to apply to someone who is a certain level, or someone who has a certain amount of points or such.

You can make a table of specific usernames, and use a for loop to go through all the usernames, and make the GUI visible for those specific people. Something like this:

local Player = game.Players.LocalPlayer
local Gui = Your gui (specifically a frame or such - not an actual ScreenGui)
local SpecificPeople = {"Player1","Player2"}

for a,b in pairs(SpecificPeople) do
    if Player.Name == b.Name then
        Gui.Visible = true
    end
end
6 Likes

You could do

for a,b in pairs(SpecificPeople) do
    if Player.Name == b.Name then
        Gui.Visible = true
else
        Gui:Destroy()
    end
end
1 Like

by the way im not that much of a scripter so if im wrong then tell me.

Yes, that also works if the GUI is automatically set to “Visible”, and can be a better option.
I just find it less of a hassle to write less code and just ensure that my gui isn’t visible before I start my game.

1 Like

Ok thank you I hope it works and I will try but where would I put that in the GUI I want visible to only certain players or in the core ScreenGui?

Exploiters could find a way to make the gui visible. (i might be wrong)

Yes that would be bad bc it gives them any amount of cash they type

1 Like

you would put that in a screengui in startergui
image

I recommend putting it in the “Screen Gui” where all your labels, frames, etc are located.

From what I’m getting out of this, is that you’re making an admin/cash giver GUI. Add restrictions and ensure you check to make sure that the correct people are actually executing things on the GUI before actually doing it.

Ok thank you I hope you have a nice day!

1 Like

Ok thank you I hope you have a good day!

1 Like

If my solution solved your problem, would you mind marking it as solution? :slight_smile:

There you go have a nice day! Thank you again!

1 Like

(edit of @Aerosphia’s code)

local Player = game.Players.LocalPlayer
local Gui = script.Parent.Frame --- (or if the script is in a screengui you would do script.Parent)
local SpecificPeople = {"Player1","Player2"}

for a,b in pairs(SpecificPeople) do
    if Player.Name == b.Name then
        Gui.Visible = true
    end
end