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

This wont restrict users from opening?

Asked by 7 years ago
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

Log in to vote
3
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago
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
Ad

Answer this question