script.Parent.Value = 0
local H = script.Parent.Value
function onClicked()
if H == 0 then
wait(1)
off()
else
on()
end
end
function off()
wait(.1)
script.Parent.Parent.Part2.CanCollide = false
wait(.1)
script.Parent.Parent.Part2.Transparency = 1
H = 1
end
function on()
wait(.1)
script.Parent.Parent.Part2.CanCollide = true
wait(.1)
script.Parent.Parent.Part2.Transparency = 0
H = 0
end
script.Parent.Parent.Part2.ClickDetector.MouseClick:connect(onClicked)
It is supposed to open/close by a click but it won't work. Why?
