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

How to make a GUI show up to a specific player?

Asked by 10 years ago

I have a GUi currently named "BannedGUI" and what I want is, if you enter anyone's name into the script (like an admin script) the GUI will show up.

1 answer

Log in to vote
0
Answered by 10 years ago

A way how you could do it and easiest way would probably to already have the Gui made and put it in StarterGui, but change the Visible property of it to false. Then run a code to see if it's the person it's looking for, and then change the Visible to true. Such as:

game.Players.PlayerAdded:connect(function(player)
    if player.Name == "BannedNameHere" then
        player.PlayerGui.BannedGUI.Visible = true
    end
end)

Or if you had a string of players who are banned, you could put them in a table and then run through it:

bannedList = {"1x1x1x1", "Telamon", "BannedName"}

game.Players.PlayerAdded:connect(function(player)
    for i, v in pairs(bannedList) do
        if player.Name == v then
            player.PlayerGui.BannedGUI.Visible = true
        end
    end
end)

If this wasn't specific enough, let me know!

0
Alright thank you. This might also help me with tables, too! TheRings0fSaturn 28 — 10y
0
Good to know! ImmenseKassing 120 — 10y
0
One problem: in the GUI object, there's no "Visible" property to it. Do I put it in the frame? TheRings0fSaturn 28 — 10y
0
Yes, if there is no Visible property, then put it into a frame, and change the frame's Visibility. It will do virtually the same thing ImmenseKassing 120 — 10y
0
I have the frame's visiblity set to false. This is a little confusing. TheRings0fSaturn 28 — 10y
Ad

Answer this question