I’m trying to make a lerping reload for guns that do not have reload animations (which right now is all, but that’s besides the point)
i told myself “oh this won’t be so difficult!”, but it’s difficult
the AK47 lerps fine, but the MK23 just… yeah you can see for yourself
PLEASE help me
local rightArm = viewmodel:FindFirstChild("Right Arm")
local leftArm = viewmodel:FindFirstChild("Left Arm")
local readyPose = viewmodel:FindFirstChild("ReadyPose")
if not (rightArm and leftArm and readyPose) then
warn("Missing parts for ReloadLerp")
return
end
local rightPose = readyPose:FindFirstChild("RightArm")
local leftPose = readyPose:FindFirstChild("LeftArm")
local viewmodelOffset = CFrame.new(-1.5, -1, 0)
local readyRightOffset = readyPose.RightArm.Value * viewmodelOffset
local readyLeftOffset = readyPose.LeftArm.Value * viewmodelOffset
if not (readyRightOffset and readyLeftOffset) then
warn("Missing ready pose offsets for arms!")
return
end
local rotation = CFrame.Angles(
math.rad(45), -- Pitch down
math.rad(45), -- Yaw left
0
)
local reloadMovement = CFrame.new(0, 0, 0)
local reloadRightOffset = (reloadMovement * rotation) * viewmodelOffset
local reloadLeftOffset = (reloadMovement * rotation) * viewmodelOffset
local originalRightOffset = camera.CFrame:ToObjectSpace(rightArm.CFrame)
local originalLeftOffset = camera.CFrame:ToObjectSpace(leftArm.CFrame)
local reloadDuration = 0.25
local startTime = tick()
rService:BindToRenderStep("ReloadLerpViewmodel", Enum.RenderPriority.Camera.Value, function()
local rawAlpha = math.clamp((tick() - startTime) / reloadDuration, 0, 1)
local alpha = math.sin((rawAlpha * math.pi) / 2)
local rightLocal = originalRightOffset:Lerp(reloadRightOffset, alpha)
local leftLocal = originalLeftOffset:Lerp(reloadLeftOffset, alpha)
rightArm.CFrame = camera.CFrame * rightLocal
leftArm.CFrame = camera.CFrame * leftLocal
end)