Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Not a valid member of PlayerGui?

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.