How do I detect the users input then stop detecting it?
I am creating a shop gui that will open and close when the players chosen key is pressed. I found out how to find the key, but not stop detecting the key after a key is pressed for the first time. Heres my code:
02 | local UIS = game:GetService( "UserInputService" ) |
03 | local player = game:GetService( "Players" ).LocalPlayer |
04 | local mouse = player:GetMouse() |
05 | local function inputDetecter() |
06 | repeat UIS.InputBegan:Connect( function (key, gp) |
08 | but.KeyVal = tostring (key.KeyCode) |
14 | but.MouseButton 1 Click:Connect( function () |