How would I make it so when a key is pressed the, GUI is visible to whoever pressed the button.
In a localscript do:
01 | local uis = game:GetService( "UserInputService" ) |
02 |
03 | local gui = script.Parent --// Define the gui |
04 |
05 | local open = false |
06 |
07 | uis.InputBegan:Connect( function (key) |
08 | if key = = Enum.KeyCode.K and not open then |
09 | gui.Enabled = true |
10 | open = true |
11 | elseif key = = Enum.KeyCode.K and open then |
12 | gui.Enabled = false |
13 | open = false |
14 | end |
15 | end ) |
Accept answer if it works else tell me
Closed as Not Constructive by Goulstem
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?