I have some basic screen gui knowledge, but for a place i am working on, i need to make the shop open when a key is pressed, similar to murder mystery. I do not need the entire shop script, just some help for opening and closing with the same button.
✓ ANSWER ACCEPTED
Open a shop by pressing a key? [SOLVED]
1 answer
✓ Accepted answer
For this you would use the KeyDown event.
--LocalScript
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local open = false
mouse.KeyDown:connect(function(key)
if key == "b" then --replace this with the key you want
if open == false then
open = true
--open the shop
elseif open == true then
open = false
--close the shop
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
one thing i forgot to ask, where in the GUI would I put this?
I tried both, but none work, is is something to do with first person being locked?
This alone does nothing. You need to add the code to open/close the shop on your own. I put comments in the code to show you where your code goes.
Thanks