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

How do I fix this player finder?

Asked by 9 years ago

Line 12 needs to find if the player is either 123thatAlt, Mendez3581, or Player1. Please help me by fixing my error in the script. There is no output from this script.

Pass= script.Parent.Parent.Parent.Passcode

function Clicked()
    for i=1, 10 do

    wait(0.1)
    script.Parent.ImageTransparency = script.Parent.ImageTransparency +0.1
    end
    script.Parent.Parent.Visible = false
    wait(0.3)

    if script.Parent.Parent.Parent.Parent.Parent.Parent.Name == {"Player1","Mendez3581","123thatAlt"} then
        for b=1,30 do
        wait(0.001)
        Pass.Position = Pass.Position + UDim2.new(0, 7, 0, 0)
        end

    end
    end

script.Parent.MouseButton1Down:connect(Clicked)

1 answer

Log in to vote
0
Answered by 9 years ago

You should setup a table at the top of your file, then check if the value is valid.

local guiOwner = script.Parent.Parent.Parent.Parent.Parent.Parent local allowedPlayers = {"Player1", "Mendez3581", "123thatAlt"}

then, at line 12, you add:

for _,plyr in ipairs(allowedPlayers) do
    if guiOwner.Name == plyr.Name then
        -- DO STUFF
    end
end
0
Im confused. What line do I add if it isn't a local script? My_Comment 95 — 9y
0
I added both the lines but still doesn't do what I want it to do. My_Comment 95 — 9y
0
is there an error, or anyone can still click the button? Tytanlore 15 — 9y
Ad

Answer this question