So im trying to make a button which opens a door, then you click it again and it closes it. Im not great at scripting but this is my attempt. (NOTE: the door works shutting and closing with a ontouch script.) The problem is that it keeps saying that error at the bottom. Ive tried lots of ends and it still says it.
Explorer of bricks and scripts: Here
b = true
a = script.Parent.Parent.Part
function onClicked(playerWhoClicked)
if b == true then
script.Sound:Stop()
a.CFrame = a.CFrame + Vector3.new(0, 0.5, 0)
script.Sound:Play()
wait(0.1)
for i=1, 17 do
a.CFrame = a.CFrame + Vector3.new(0, 0.5, 0)
wait(0.1)
b = false
end
else
wait(0.1)
wait(4)
script.Sound:Play()
for i=1 ,18 do
a.CFrame = a.CFrame + Vector3.new(0, -0.5, 0)
wait(0.1)
end
wait(3)
b = true
end
end
end --Expected <eof>, got 'end'
script.Parent.ClickDetector.MouseClick:connect(onClicked)

2 comments
Thank you, im relieved that was the only thing wrong. Because i wanted to make it all on my own xD Thank you :)
No problem.