local UserInputService = game:GetService("UserInputService") local isPressed = UserInputService:IsKeyDown(Enum.KeyCode.E) if isPressed then script.Parent.Visible = true else script.Parent.Visible = false end
This is the initial script I had. I don't get any errors when testing it, and nothing happens when I press E.
local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input) if Input.KeyCode == Enum.KeyCode.E then --script.Parent.Visible = true else --script.Parent.Visible = false end end)
This is the script that AswormeDorijan111 gave me. It works... but not in the way i'm wanting it too.
I need the script to open a menu ONLY while the E button on the keyboard is being HELD DOWN. As soon as the button isn't being held down anymore, I want the menu to disapear. Anyone have some help for me?
You need a function to inversely handle when the key is lifted as well, you can use InputEnded for this.