How to lock a key so it cant be pressed anymore for a period of time?
Asked by
7 years ago Edited 7 years ago
So i made a script to open a gui when you press a key but if you will mash the key the gui will kinda brake.
I want to know if there is a way to block they key when the gui is tweening so it doesnt bug it out
01 | button = script.Parent.button |
02 | frame = script.Parent.Parent.ColorsAvailable.Frame |
03 | stop = script.Parent.button.waiting |
04 | stop 1 = script.Parent.button.waiting.dot 1 |
05 | stop 2 = script.Parent.button.waiting.dot 2 |
06 | stop 3 = script.Parent.button.waiting.dot 3 |
07 | text = script.Parent.button.TextButton |
08 | mouse = game.Players.LocalPlayer:GetMouse() |
10 | mouse.KeyDown:connect( function (key) |
11 | if (string.lower(key) = = "c" ) and (a = = 0 ) then |
13 | game.Soundscape.buttonpress.PlaybackSpeed = 1 |
14 | game.Soundscape.buttonpress:Play( 1 ) |
16 | frame:TweenPosition(UDim 2. new( 0.2 ,- 100 , 0.9 , 0 ), 'Out' , 'Quad' , 0.35 ) |
17 | button:TweenPosition(UDim 2. new( 0.2 ,- 100 , 0.8 , 20 ), 'Out' , 'Quad' , 0.175 ) |
33 | elseif (string.lower(key) = = 'c' ) and (a = = 1 ) then |
35 | game.Soundscape.buttonpress.PlaybackSpeed = 1.5 |
36 | game.Soundscape.buttonpress:Play( 1 ) |
37 | frame:TweenPosition(UDim 2. new( 0.2 ,- 100 , 1 , 0 ), 'In' , 'Quad' , 0.35 ) |
38 | button:TweenPosition(UDim 2. new( 0.2 ,- 100 , 0.9 , 0 ), 'In' , 'Quad' , 0.35 ) |