heres my attemp:
local wall = script.Parent local mouse = game.Player:GetMouse() local click = game.Workspace.wall1.ClickDetector:Touched()
local function closeWall(part)
wall.CanCollide = true
for transparency = 0, 0, 0 do
door.Transparency = transparency
wait(.1)
end
function openDoorOnClick() if mouse.click.wall then wall.CanCollide = false for transparency = 1, 0, -.1 do door.Transparency = transparency wait(.1) wait(5) closeWall end
You can't touch a click detector.
Try doing:
local wall = script.Parent local click = game.Workspace.wall1.ClickDetector.MouseClick local function closeWall() wall.CanCollide = true for transparency = 0, 0, 0 do door.Transparency = transparency wait(.1) end function openDoorOnClick() wall.CanCollide = false for transparency = 1, 0, -.1 do door.Transparency = transparency wait(.1) wait(5) closeWall() end click:connect(openDoorOnClick)
You also don't need to get the mouse. You also need to use the events.