I’m having issues where when I switch weapons, it doesn’t look right, especially the sword. Problem being, the default rig spawns the weapon in the HRP, and thus before the animation players, the weapon is in your head and then moves to the animation position. If you slow the video down, the sword goes from the start pos, to the animated pos, which looks bad

ViewModel = game.ReplicatedStorage:WaitForChild("ViewModel"):Clone()
ViewModel.HumanoidRootPart.CFrame = workspace.Camera.CFrame - Vector3.new(0, 5, 0)
ViewModel.Parent = workspace.CurrentCamera
GunModel = game.ReplicatedStorage.Sword:Clone()
Framework.WeldGun(GunModel)
RecoilSpring = Spring.new()
BobbleSpring = Spring.new()
SwayingSpring = Spring.new()
Framework.Equip(ViewModel, GunModel, GunModel.Animations.Hold)
Update = game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
Framework.Update(ViewModel, deltaTime, RecoilSpring, BobbleSpring, SwayingSpring)
end)
function Framework.Equip(viewModel, gun, hold)
local Handle = gun.Components.Handle
local HumanoidRootPartMotor = viewModel:WaitForChild("HumanoidRootPart").Handle
gun.Parent = viewModel
HumanoidRootPartMotor.Part1 = Handle
game:GetService("ContentProvider"):PreloadAsync({hold})
local Hold = viewModel.AnimationController.Animator:LoadAnimation(hold)
Hold:Play()
end
I preload the animation, but there’s still a period of time where the sword moves from head to arm and just looks terrible. Also unsure why changing to sword takes longer to get ready compared to the guns