###Mouse.KeyDown is deprecated, and so is connect. The KeyDown could be your problem.
###You should switch to ContextActionService or UserInputService to get user input. Personally, I’d prefer ContextActionService, mainly because you can bind actions to functions, make mobile exclusive buttons, and bind multiple keys to functions without if statements.
function toggleGui()
Frame.Visible = not Frame.Visible
end
game:GetService("ContextActionService"):BindAction(
"Toggle",
toggleGui,
true,
Enum.KeyCode.K,
Enum.KeyCode.E,
Enum.KeyCode.F
)
###That’s how to use this awesome service. That’s also how to bind multiple keys. You can use just one as well, of course.
4 comments
you are using keydown
Why are you wrapping your if statements in brackets?
@incapaz It's just a habit. Nothing wrong with it. It's actually a pretty good one. Don't quote me on this but I believe it's actually proper. I'm not totally sure tho.
yes in lua and python wrapping it in brackets is proper but not needed but i fixed this problem