Door Only Opens, Won't Close [FIXED]

Hi Everyone!

I hope this is the right place to post it but I can’t find an answer from anywhere, I scripted this keybind door and it will only open, it wont close. Any Ideas?

Thanks,

ServerWide DoorMain Script: local Can = truelocal Open = falsescript.Parent.Event.OnServerEvent:connec - Pastebin.com
Local Script: local inputservice = game:GetService("UserInputService")inputservice.InputBe - Pastebin.com

1 Like

I believe I’ve found the problem. By indenting your code, I was able to see that the Can = true assignment was only being run where Open ~= false. This meant that Open was set to true when you opened it, and Can was set to false and never set back to true which meant that the code could never run again because it did not meet the Can == false condition.

Here’s a badly illustrated screenshot of how to fix this:

this bad illustration does not help me fix this, idk what you want me to do lol

Fixed it! Thanks for the help though, I accidently put it as -math instead of -90

Not sure how this fixed it, but if it works, it works. What I was trying to illustrate is that you need to move the Can = true line outside of the if Open == false then/else statement. Otherwise after being set to false, it will never pass the if Can then condition.

It’d be nicer if you put the code in code blocks on your thread instead of off-site links because not only is this a public category on the DevForum, but it’s also better if we can read the code immediately without opening side links to view code, you know? Convenience purposes. :+1:

Sorry still getting used to the features!

1 Like