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
I get no errors when I test it, but nothing happens when I press the KeyCode
Uhh... I just don't like how you write that script.
local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input) if Input.KeyCode == Enum.KeyCode.E then --script.Parent.Visible = true end end) UserInputService.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.E then --script.Parent.Visible = false end end)
This will solve your problem. You can't use UserInputService:IsKeyDown(Enum.KeyCode.E), use the method from my script.