Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Open a shop by pressing a key? [SOLVED]

Asked by
xancor1 10
10 years ago

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

Log in to vote
1
Answered by
MrFlimsy 345 Moderation Voter
10 years ago

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
0
one thing i forgot to ask, where in the GUI would I put this? xancor1 10 — 10y
0
I tried both, but none work, is is something to do with first person being locked? xancor1 10 — 10y
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. MrFlimsy 345 — 10y
0
Thanks xancor1 10 — 10y
Ad

Answer this question