Hi, I’m trying to make my own viewmodel. I’ve ran into an issue when trying to make the viewmodel bob up and down. I have a system so that where ever you move the ArmAttachments the arms of the viewmodel will go to that spot just so I don’t have to do trial and error when trying to place the arms correctly on a gun. This works fine but I’m now trying to make the arms bob up and down and nothing is working. I’ve looked up many ways to create a bobbing effect and I’ve had no success. It just seems like the arms aren’t bobbing at all and are just working as if the code wasn’t even there. I’m completely stuck and I don’t know what to do so this is my last resort.
Here’s the snippet of code that updates the arms:
local function update()
viewModel.LeftArmAttachment.CFrame:Lerp(CFrame.new(
0.016 * math.sin(tick() * 6) * (humanoid.WalkSpeed / 12),
0.024 * math.sin(tick() * 12) * (humanoid.WalkSpeed / 12),
0
),0.1)
viewModel.RightArmAttachment.CFrame:Lerp(CFrame.new(
0.016 * math.sin(tick() * 6) * (humanoid.WalkSpeed / 12),
0.024 * math.sin(tick() * 12) * (humanoid.WalkSpeed / 12),
0
),0.1)
viewModel.Head.CFrame = (camera.CFrame)
arms.LeftArm.CFrame = viewModel.LeftArmAttachment.CFrame
arms.RightArm.CFrame = viewModel.RightArmAttachment.CFrame
end
game:GetService("RunService").RenderStepped:Connect(update)