Advertisement
Guest User

The Problem 1

a guest
Feb 16th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. local aimCount = 0;
  2. local offset = weapon.Handle.CFrame:inverse() * weapon.Aim.CFrame;
  3.  
  4. local function aimDownSights(aiming)
  5. local start = joint.C1;
  6. local goal = aiming and joint.C0 * offset or CFrame.new();
  7.  
  8. aimCount = aimCount + 1;
  9. local current = aimCount;
  10. for t = 0, 101, 10 do
  11. if (current ~= aimCount) then break; end
  12. game:GetService("RunService").RenderStepped:Wait();
  13. joint.C1 = start:Lerp(goal, t/100);
  14. end
  15. end
  16.  
  17. local function onInputBegan(input, process)
  18. if (process) then return; end
  19. if (input.UserInputType == Enum.UserInputType.MouseButton2) then
  20. aimDownSights(true);
  21. end
  22. end
  23.  
  24. local function onInputEnded(input, process)
  25. if (process) then return; end
  26. if (input.UserInputType == Enum.UserInputType.MouseButton2) then
  27. aimDownSights(false);
  28. end
  29. end
  30.  
  31. game:GetService("UserInputService").InputBegan:Connect(onInputBegan);
  32. game:GetService("UserInputService").InputEnded:Connect(onInputEnded);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement