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

Not a valid member of PlayerGui?

Asked by 9 years ago

Hi I was doing a thing where if you were an admin you had a special gif, but if you weren't admin then it didn't show the gif. But with my script it just says SnoopDogg is not a valid member of StarterPlayer. Can you help?

local admins = {"docrobloxman52", "BloxTiger531", "mega6566", "TextWaffles", "mrcopperol"}

plr = game.Players.LocalPlayer



if plr.Name == admins then
    script.Parent.Text = "Welcome Admin"
    print("mer")
    script.Parent.Parent.Parent.Parent.SnoopDogg.SNOOP.SNOOP.Visible = true
elseif plr.Name ~= "docrobloxman52" or "Player" then
    script.Parent.Text = "Welcome "..plr.Name.."!"
    script.Parent.Parent.Parent.Parent.SnoopDogg.SNOOP.SNOOP.Visible = false
end

1 answer

Log in to vote
0
Answered by
MunimR 125
9 years ago

Here there are quiet a few issues with you code, but I believe this should work :)

local admins = {"docrobloxman52", "BloxTiger531", "mega6566", "TextWaffles", "mrcopperol", "Player"}

local player = game:GetService'Players'.LocalPlayer

local label = script.Parent
local snoopie = label.Parent.Parent.Parent:WaitForChild'SnoopDogg':WaitForChild'SNOOP':WaitForChild'SNOOP'

local isAdmin = false
for _,admin in pairs(admins) do
    if player.Name:lower() == admin:lower() then
        isAdmin = true
    end
end

if isAdmin then
    label.Text = "Welcome admin!"
    snoopie.Visible = true
else
    label.Text = "Welcome "..player.Name.."!"
    snoopie.Visible = false
end
Ad

Answer this question