kirda

5

Mar 12th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. --!nolint
  2. local UserInputService = game:GetService("UserInputService")
  3.  
  4. local MouseMovementConnection
  5.  
  6. local function OnInputChanged(Input)
  7.     if Input.UserInputType ~= Enum.UserInputType.MouseMovement then
  8.         return
  9.     end
  10.    
  11.     print("This will only print when you have the tool equipped")
  12. end
  13.  
  14. local function onEquipped()
  15.     MouseMovementConnection = UserInputService.InputChanged:Connect(OnInputChanged)
  16. end
  17.  
  18. local function onUnequipped()
  19.     selectionBox.Adornee = nil
  20.    
  21.     MouseMovementConnection:Disconnect()
  22. end
  23.  
  24. script.Parent.Activated:Connect(onActivated)
  25. script.Parent.Equipped:Connect(onEquipped)
  26. script.Parent.Unequipped:Connect(onUnequipped)
Advertisement
Add Comment
Please, Sign In to add comment