First of all using Mouse to use keyboard is limited use and also deprecated its a bad practice to use it, i suggest start using "UserIputService" which you will have more control on your input.
API
http://wiki.roblox.com/index.php?title=API:Class/UserInputService
How to use one
http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputBegan
Example:
This example must be inside of your player or character and must be localscript or else wont work.
this will work also inside of the tool because since tool is equipped then tool is transferred to the player character since localscript is inside the tool. got it?
---LOCALSCRIPT
01 | local player = game.Players.LocalPlayer |
02 | local UIS = game:GetSerivce( "UserInputService" ) |
03 | local Anim = player.Character.Humanoid:LoadAnimation(script.Punch 1 ) |
04 | local Anim 2 = player.Character.Humanoid:LoadAnimation(script.Punch 2 ) |
09 | UIS.InputBegan:connect( function (key, gameproc) |
10 | if not gameproc and key.KeyCode = = Enum.KeyCode.Q and Combo = = 1 then |
14 | local lefthand = player.Character:FindFirstChild( "LeftHand" ) |
15 | lefthand.Touched:connect( function (hit) |
16 | if hit.Parent:FindFirstChild( "Humanoid" ) and CanDamage = = true then |
17 | hit.Parent:FindFirstChild( "Humanoid" ):TakeDamage( 10 ) |
21 | elseif not gameproc and key.KeyCode = = Enum.KeyCode.Q and Combo = = 2 then |
25 | local lefthand = player.Character:FindFirstChild( "LeftHand" ) |
26 | lefthand.Touched:connect( function (hit) |
27 | if hit.Parent:FindFirstChild( "Humanoid" ) and CanDamage = = true then |
28 | hit.Parent:FindFirstChild( "Humanoid" ):TakeDamage( 10 ) |
Gameproc or GameProcessed needs to be check false so while in the middle of typing in chat the input or key you set is pressed wont activate it. so it will not be annoying sometimes.
Press answer if this helps you!
~~Neuroticxs