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

Why does this Gui not appear to the certain players I put in the script?

Asked by 6 years ago

I'm trying to make an Admin Gui but the script is not making the gui appear it is in a local script so I don't see whats wrong with it.

local player = game.Players.LocalPlayer

if player.Name == {"MasonTheCreeperYT3", "tfishy5"} then
    player.PlayerGui.AdminPanel.Gui = true
else
    player.PlayerGui.AdminPanel.Gui = false
end

1 answer

Log in to vote
1
Answered by
LeadRDRK 437 Moderation Voter
6 years ago

You're not checking whether the player is an admin correctly. You must a for loop to check though every name in array and see if the player's name is the admin's name. And, to enable a gui, you must use the Visible property of the GuiObject; not using itself

local player = game.Players.LocalPlayer
local admins = {
    "MasonTheCreeperYT3", 
    "tfishy5"
}

for i,v in pairs(admins) do
    if player.Name == v then
        player.PlayerGui.AdminPanel.Gui.Visible = true
    else
        player.PlayerGui.AdminPanel.Gui.Visible = false
    end
end

Ad

Answer this question