Help with Aim Down Sight System

So i have this ADS system, where I use the R6 character’s arms:


and here is the code I use:

trackAim:Play()
camera.CameraType = Enum.CameraType.Scriptable
aim.Parent = char

anim = run.Heartbeat:Connect(function()
        camera.CFrame = camera.CFrame:Lerp(aim.CFrame * CFrame.new(0,0,.5), .2)
end)

task.wait(.1)

anim:Disconnect()
player.CameraMode = Enum.CameraMode.LockFirstPerson
uis.MouseBehavior = Enum.MouseBehavior.LockCenter

camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = aim

“aim” its the aimpart.

The problem is that the camera goes sideways while walking to left or right (in some cases also while moving forward or backwards)
Thats all, thank you!

4 Likes

Weird… I made something very similar yesterday.

Not sure if it’s exactly what you’re looking for, as it doesn’t seem to use tools, but I followed the first two vids of this playlist to make this:

Please excuse framerate, and I didn’t build the Luger model.

1 Like

Use TweenService to tween the CFrame so it doesn’t go sideways while walking

1 Like

hi, Im using Lerp like in that playlist, It doesnt work for me because of the physics of the character’s arms

Im doing that rn, it seems more smooth but the goal doesnt change if you move with the gun as using Lerp, so this happens:

Also I tried using Render Stepped with the Lerp but didnt work

I haven’t noticed anything wrong with mine, it’s hard to tell in that vid cos of the lag but it’s only like that when I’m recording. I’m not really sure why that’s happening cos it’s my first time using Lerp, I kinda just followed the video and I’m only as far that, but here’s a part of the code that uses it, If you want to see the whole code, just lmk and I’ll send it.

RunService.RenderStepped:Connect(function()
   
   local rot = camera.CFrame:ToObjectSpace(lastCameraCF)
   local X,Y,Z = rot:ToOrientation()
   swayCF = swayCF:Lerp(CFrame.Angles(math.sin(X) * currentSwayAMT, math.sin(Y) * currentSwayAMT, 0), .1)
   lastCameraCF = camera.CFrame
   
   for i,v in pairs(camera:GetChildren()) do
   	if v:IsA("Model") then
   		v:SetPrimaryPartCFrame(camera.CFrame * swayCF * aimCF)
   	end
   end
   
   if isAiming and framework.viewmodel ~= nil and framework.module.canAim then
   	local offset = framework.viewmodel.AimPart.CFrame:ToObjectSpace(framework.viewmodel.PrimaryPart.CFrame)
   	aimCF = aimCF:Lerp(offset, .1)
   	currentSwayAMT = aimSwayAMT
   else
   	local offset = CFrame.new()
   	aimCF = aimCF:Lerp(offset, framework.module.aimSmooth)
   	currentSwayAMT = swayAMT
   end
end)

You can test it if you want to see if I have the same issue and just missed it or something:

1 Like

thank you, you are using a viewmodel, right?

1 Like

Yup. I’m not sure if it’s going to be using tools at all yet. If it doesn’t then that might be a problem for me, but I’ll p

1 Like