Secret Doorway (Touch)

Secret Doorway

Where to put this Script

In a script in the part that will be touched to open the wall or door

Script

Make Wall Go Up

local part = script.Parent
local wall = game.Workspace.Wall
local canOpen = true

local function lift(otherPart)
    local partParent = otherPart.Parent
    local humanoid = partParent:FindFirstChildWhichIsA('Humanoid')
    if humanoid and canOpen then
        canOpen = false
        wall.Position = wall.Position + Vector3.new(0,12,0)
        wait(3)
        wall.Position = wall.Position + Vector3.new(0,-12,0)
        canOpen = true
    end
end

part.Touched:Connect(lift)

Make Wall Disappear

local part = script.Parent
local wall = game.Workspace.Wall
local canOpen = true

local function lift(otherPart)
    local partParent = otherPart.Parent
    local humanoid = partParent:FindFirstChildWhichIsA('Humanoid')
    if humanoid and canOpen then
        canOpen = false
        wall.Transparency = 1
        wall.CanCollide = false
        wait(3)
        wall.Transparency = 0
        wall.CanCollide = true
        canOpen = true
    end
end

part.Touched:Connect(lift)