Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local aimCount = 0;
- local offset = weapon.Handle.CFrame:inverse() * weapon.Aim.CFrame;
- local function aimDownSights(aiming)
- local start = joint.C1;
- local goal = aiming and joint.C0 * offset or CFrame.new();
- aimCount = aimCount + 1;
- local current = aimCount;
- for t = 0, 101, 10 do
- if (current ~= aimCount) then break; end
- game:GetService("RunService").RenderStepped:Wait();
- joint.C1 = start:Lerp(goal, t/100);
- end
- end
- local function onInputBegan(input, process)
- if (process) then return; end
- if (input.UserInputType == Enum.UserInputType.MouseButton2) then
- aimDownSights(true);
- end
- end
- local function onInputEnded(input, process)
- if (process) then return; end
- if (input.UserInputType == Enum.UserInputType.MouseButton2) then
- aimDownSights(false);
- end
- end
- game:GetService("UserInputService").InputBegan:Connect(onInputBegan);
- game:GetService("UserInputService").InputEnded:Connect(onInputEnded);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement