Also how can i make some value rapidly increase while that button is being held?
The answer is pretty simple. You can use the service "UserInputService" to sense when a key is being pressed. For example:
01 | local UserInputService = game:GetService( "UserInputService" ) |
02 |
03 | UserInputService.InputBegan:Connect( function (key) -- Senses when a key is pressed |
04 | if key = = Enum.Key.Q then --Change Q to any key |
05 | --Code |
06 | end |
07 | end ) |
08 |
09 | UserInputService.InputEnded:Connect( function (key) -- Senses when a key is let go |
10 | if key = = Enum.Key.Q then --Change Q to any key |
11 | --Code |
12 | end |
13 | end ) |