I was to make the shop open by pressing the L key instead of clicking the button. What do I have to do to make that change?
Here is the script...
local frame = script.Parent local close = frame:WaitForChild("Close") local shop = frame.Parent:WaitForChild("Shop")
shop.MouseButton1Click:connect(function() shop.Visible = false frame.Visible = true end)
close.MouseButton1Click:connect(function() shop.Visible = true frame.Visible = false end)
Well, in your script, you opened the GUI VIA MouseButton1Down event. If you want to open it with key, you would want to use the InputBegan event of the GameService 'UserInputService'.
local frame = script.Parent local close = frame:WaitForChild("Close") local shop = frame.Parent:WaitForChild("Shop") local uis = game:GetService'UserInputService' -- Define it local opened = false -- Tell the game that they haven't opened yet uis.InputBegan:Connect(function(key, gameProc) -- Connect to the function once a button press is detected -- Key is the key that is pressed and gameProc basically returns a boolean whether the key was pressed in chatbox or not. if key.KeyCode == Enum.KeyCode.L and not gameProc then -- If the key == "L" and they're not chatting if not opened then -- If opened is false opened = true shop.Visible = false frame.Visible = true elseif open then -- If open is true open = false shop.Visible = true frame.Visible = false end end end)