Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Open a shop by pressing a key? [SOLVED]

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.

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

4 comments

0

one thing i forgot to ask, where in the GUI would I put this?

0

I tried both, but none work, is is something to do with first person being locked?

0

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.

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.