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

How to make 3 buttons that will open 1 door but not closing this door?

Asked by 3 years ago

How to make 3 buttons with click detectors that will open the door (but after you click the button it can no longer clicked), and this door will stay opened forever and cant be closed or opened.

How i want it to be: there will 3 buttons at different locations and 1 door. To open door you need to click all 3 buttons and only then door will be opened, for example if you click any 1 or 2 of 3 buttons the door will not be opened until you click the 3rd button.

Sorry that it looks like a request, i just dont know what i need to write in script to make this, what things do you need to write in script.

thank you if you answer my question

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
local steps = {
    p1 = false,
    p2 = false,
    p3 = false,
}


workspace.Part1.Button1.MouseClick:Connect(function()
    if steps.p1 == false then -- makes sure that they didnt press this button already
        steps.p1 = true

        -- can also change color of button or somthin here to let players know that the button is already used

        if steps.p2 and steps.p3 == true then -- checks to see if all 3 are pressed
            workspace.door:Destroy() -- opens door
        end
    end
end)

workspace.Part2.Button2.MouseClick:Connect(function()
    if steps.p2 == false then
        steps.p2 = true

        if steps.p1 and steps.p3 == true then
            workspace.door:Destroy()
        end
    end
end)

workspace.Part3.Button3.MouseClick:Connect(function()
    if steps.p3 == false then
        steps.p3 = true

        if steps.p2 and steps.p1 == true then
            workspace.door:Destroy()
        end
    end
end)
0
thank you so much slimeking12399 6 — 3y
Ad

Answer this question