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

This wont restrict users from opening?

script.Parent.MouseButton1Click:connect(function()
	if script.Parent.Parent.Parent.Parent.Name == "johndeer2233" or "DrMinerSCP" or "Matt27832" then
		local GuiFrame = game.Players.LocalPlayer:WaitForChild("PlayerGui").AdminPanel.Background
	  if GuiFrame.Visible == false then
		GuiFrame.Visible = true
		script.Parent.Text = "Admin Panel: Close"
	else 
		GuiFrame.Visible = false
		script.Parent.Text = "Admin Panel: Open"	
		
	        end
	    else
		script.Parent.Text = "You Must Be An Admin To Open This"
	end
end)

I want this so that if your name is not on this list it sais You Must be and admin... but it won't I have no error this is a Local Script but I have tried localplayer as the if statement but it lets you open it even though your name is not on the list.

1 answer

✓ Accepted answer
if script.Parent.Parent.Parent.Parent.Name == "johndeer2233" or "DrMinerSCP" or "Matt27832" then

Is the issue here.

An if statement requires you to do a complete 'if statement' on each or, or and. The correct way to do so would be:

N = game.Players.LocalPlayer.Name
if N == "johndeer2233" or N == "DrMinerSCP" or N == "Matt27832" then

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