Your code indentation is erroneous and hence it is harder to observe that you have mismatched end
s.
I don't understand why, on line 12, you return
if the condition is true. I don't think you meant to type that, but rather:
1 | if Updatelog.CFrame = = CFrame.new( 213 , 180.4 , 62 ) then |
3 | OpenedOrClosed = "Opened" |
It's difficult to understand what a lot of your code is supposed to do. At the moment, it continually loops because (I'm guessing) in the second loop, the condition "bool == false" is never reached.
It may be that you only want to trigger the Opened/Closed behaviour separately, in which case you can use an elseif
check (on line 18) rather than plain if
; that way, when the user clicks, only the code for 'Opened' or 'Closed' will be triggered, but not both.
Another minor point is that, when dealing with boolean values in conditions, someVariable == true
is the same as writing someVariable
and `someVariable == false' is the same as writing 'not someVariable'. So, for example, your while loop on line 9 could be written:
Summary
- Indent your code properly. This will help you identify mismatched
ends
and will help others be able to read your code easier.
- Think about if you need to use
if
or elseif
- In future questions, try and explain what is supposed to happen in more detail