Answered by
6 years ago Edited 6 years ago
First of all, KeyDown is deprecated. It works in Studio but not in the actual game. Second, you wasted a lot of time making the same variables over and over. Same with all the extra functions.
Instead of using KeyDown, use the UserInputService. Also, don't make the same variables and functions over and over.
A shortened example of what you're doing:
01 | local player = game.Players.LocalPlayer |
02 | local UIS = game:GetService( "UserInputService" ) |
03 | UIS.InputBegan:Connect( function (input, gpe) |
04 | if not gpe and input.KeyCode = = Enum.Q then |
05 | part = Instance.new( "Part" , game.Workspace) |
07 | part.CFrame = player.Character.Head.CFrame * CFrame.new( 0 , - 2 , - 15 ) |
11 | partA = Instance.new( "Part" , game.Workspace) |
13 | partA.CFrame = player.Character.Head.CFrame * CFrame.new( 0 , - 2 , - 15 ) |
These are a couple mistakes. The answer to your question is lag...... I think. Also, even if Keydown wasn't deprecated, its pointless to do the "Key = Key:lower()" part.
Hope this helps