The goal of this script is whenever a player presses G, a frame should be visible. However, it doesn't and I can't seem to find the issue. Here's the code:
local frame = script.Parent:WaitForChild("Frame")
local open = script.Parent.Open
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.G then
if open.Value == false then
frame.Visible = true
open.Value = true
elseif open.Value == true then
frame.Visible = false
open.Value = false
end
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Anyone found the problem?

1 comment
just do if frame.Visibe == true then frame.Visible = false i guess or you can try and make UserInputService a variable. or do :Connect since i think :connect is depricated