Aim down sights bugged

  1. What do you want to achieve? Keep it simple and clear!
    i want to make aim down sights for my gun

  2. What is the issue? Include screenshots / videos if possible!

as you can see in the video the camera should lerp to the aimpart but as soon as i equip the tool my camera gets stuck into the tool’s(PrimaryPart) and when i aim it lerps to aimpart. it should be reversed i am desperate for a solution

this is the bug

Gun:PivotTo(Camera.CFrame * aimCF )

local Aiming = false 
local AimPart =  Gun:WaitForChild("AimPart")
local aimCF = CFrame.new()
local offset


RunS.RenderStepped:Connect(function(deltaTime)
	if  Aiming then
		
		 offset = AimPart.CFrame:ToObjectSpace(Gun.PrimaryPart.CFrame) 
		aimCF = aimCF:Lerp(offset, 0.1)
		Gun:PivotTo(Camera.CFrame * aimCF )
		
	else
		
		 offset = CFrame.new()
		aimCF = aimCF:Lerp(offset, 0.1)
		Gun:PivotTo(Camera.CFrame * aimCF)
	end
end)

maybe try this:

local Aiming = false 
local AimPart =  Gun:WaitForChild("AimPart")
local aimCF = CFrame.new()
local offset


RunS.RenderStepped:Connect(function(deltaTime)
	if  Aiming then
		
		 offset = AimPart.CFrame:ToObjectSpace(Gun.PrimaryPart.CFrame) 
		aimCF = aimCF:Lerp(offset, 0.1)
		Gun:PivotTo(Camera.CFrame * aimCF )
		
	else
		
		 offset = CFrame.new()
                 offset = offset + Vector3.new(0,1,0)
		aimCF = aimCF:Lerp(offset, 0.1)
		Gun:PivotTo(Camera.CFrame * aimCF)
	end
end)

this moves it up slightly it might fix it

it didn’t work when i equip, the guns cframe sets to the cameras cframe as u can see in the video