I'm new to scripting and I'm doing a simple game. When I click the block that this script is in it works the first time, it stays opens then closes automatically but when I click it again it just stays open. How can I make this close automatically on the other tries?
local block = game.Workspace.ObbyI.blockI
function onClicked()
block.Transparency = .7
block.CanCollide = false
end
script.Parent.ClickDetector.MouseClick:connect (onClicked)
wait(10)
block.Transparency = 0
block.CanCollide = true

7 comments
It didn't work When I tried this script it said attempt to call a nil value
Give it a try now, I edited it.
It says the same thing
Can you tell me the exact error?
It says "attempt to call a nil value" (sorry for the late reply)
Which line? If you look at the output, it tells you which line it is on.
It literally only says "18:41:43.171 - attempt to call a nil value" Also when I click it the door doesn't open