I’m trying to open a GUI when ‘G’ is pressed. Although it doesn’t register or even fire the function.
local service = game:GetService("UserInputService")
local actionT = service:IsKeyDown(Enum.KeyCode.G)
local gui = script.Parent
local function inputInbound(input, _gameProcessedEvent)
if actionT then
if gui.Enabled then
gui.Enabled = false
print("Key registered. Closing.")
else
gui.Enabled = true
print("Key registered. Opening.")
end
end
end
service.InputBegan:Connect(inputInbound)
I’ve tried multiple solutions, including making a local function, putting the function body into the event function, none worked. It doesn’t even print the message. And yes, my G key works…