Vpov

Untitled

Apr 3rd, 2021
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer
  2. local Mouse = Player:GetMouse()
  3. local UserInputService = game:GetService('UserInputService')
  4.  
  5. local HoldingControl = false
  6.  
  7. Mouse.Button1Down:connect(function()
  8.     if HoldingControl then
  9.         Player.Character:MoveTo(Mouse.Hit.p)
  10.     end
  11. end)
  12.  
  13. UserInputService.InputBegan:connect(function(Input, Processed)
  14.     if Input.UserInputType == Enum.UserInputType.Keyboard then
  15.         if Input.KeyCode == Enum.KeyCode.LeftControl then
  16.             HoldingControl = true
  17.         elseif Input.KeyCode == Enum.KeyCode.RightControl then
  18.             HoldingControl = true    
  19.         end
  20.     end
  21. end)
  22.  
  23. UserInputService.InputEnded:connect(function(Input, Processed)
  24.     if Input.UserInputType == Enum.UserInputType.Keyboard then
  25.         if Input.KeyCode == Enum.KeyCode.LeftControl then
  26.             HoldingControl = false
  27.         elseif Input.KeyCode == Enum.KeyCode.RightControl then
  28.             HoldingControl = false
  29.         end
  30.     end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment