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
11 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
11 years ago

For this you would use the KeyDown event.

01--LocalScript
02 
03local player = game.Players.LocalPlayer
04local mouse = player:GetMouse()
05 
06local open = false
07 
08mouse.KeyDown:connect(function(key)
09    if key == "b" then --replace this with the key you want
10        if open == false then
11            open = true
12            --open the shop
13        elseif open == true then
14            open = false
15            --close the shop
16        end
17    end
18end
0
one thing i forgot to ask, where in the GUI would I put this? xancor1 10 — 11y
0
I tried both, but none work, is is something to do with first person being locked? xancor1 10 — 11y
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 — 11y
0
Thanks xancor1 10 — 11y
Ad

Answer this question