Advertisement
HowToRoblox

DetectInputScript

Jan 12th, 2020
1,765
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2.  
  3. local toggleSprintEvent = game.ReplicatedStorage:WaitForChild("ToggleSprint")
  4.  
  5.  
  6. uis.InputBegan:Connect(function(key, processed)
  7.    
  8.     if processed then return end
  9.    
  10.     if key.KeyCode == Enum.KeyCode.LeftControl then
  11.        
  12.         toggleSprintEvent:FireServer(true)
  13.        
  14.     end
  15.    
  16. end)
  17.  
  18.  
  19. uis.InputEnded:Connect(function(key, processed)
  20.    
  21.     if processed then return end
  22.    
  23.     if key.KeyCode == Enum.KeyCode.LeftControl then
  24.        
  25.         toggleSprintEvent:FireServer(false)
  26.        
  27.     end
  28.    
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement