I’m making a gun system and I need the gun to transition towards the camera to aim down sights. The issue is that the gun kind of falls downwards (since the entire gun is unanchored)
If I anchor the gun, then it won’t be able to play animations.
run.RenderStepped:Connect(function()
if uis:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
gun.PrimaryPart = gunModel:WaitForChild("AimPart")
gun.Parent = cam
for i = 0, 1, 0.05 do
gun.PrimaryPart.CFrame = gun.PrimaryPart.CFrame:Lerp(cam.CFrame, i)
task.wait()
end
else
-- code here runs when player isn't aiming down sights
end
end)
The code works as intended, just the gun is falling downwards when trying to aim down sights and I don’t know how to fix this without anchoring the gun