My goal : I am trying to make a script that opens a window when you click a GUI button the closes that window if it is visible when the button is clicked again. The problem: when i click the button again and again it just keeps printing level 1 complete and stops there it also opens the window., i get no errors in the output to.
a=script.Parent.Parent.Frame
b=script.Parent.Parent.Frame.VoteText
script.Parent.MouseButton1Click:connect(function()
a.Visible=true
b.Visible=true
print("level 1 complete")
end)
function onClicked()
a.Visible=false
b.Visible=false
print("level 3 complete")
end
if a.Visible==true and b.Visible==true then
script.Parent.MouseButton1Click:connect(onClicked)
print ("level 2 complete")
else
print("you failed")
return end

3 comments
First off, you should consider tabbing the code correctly to make it easier to read. Second, there's a bunch of problems in this.
yeah its been a while since i scripted on roblox but i dont see the problems and i tabbed it correctly now
you say there is alot of errors but you wont point them out?