I'm getting no errors. The animation works fine when I play it in the same model in the workplace.
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character
local cam = workspace.CurrentCamera
local reps = game:GetService("ReplicatedStorage")
local runs = game:GetService("RunService")
local gun = reps:WaitForChild("famas"):Clone()
for i,v in pairs (gun:GetChildren()) do
if v:IsA("BasePart") or v:IsA("UnionOperation") then
if v ~= gun.PrimaryPart then
local weld = Instance.new("Weld")
weld.Part0 = gun.PrimaryPart
weld.Part1 = v
weld.C0 = gun.PrimaryPart.CFrame:Inverse()
weld.C1 = v.CFrame:Inverse()
weld.Name = v.Name
weld.Parent = gun.PrimaryPart
end
end
end
gun.Parent = cam
gun.Humanoid:LoadAnimation(gun.animations.idle):Play()
runs.RenderStepped:connect(function()
gun:SetPrimaryPartCFrame(cam.CFrame*CFrame.new(0,-1.5,0))
game:GetService("UserInputService").MouseIconEnabled = false
plr.PlayerGui.hud.mouse.Position = UDim2.new(0, ((game.Players.LocalPlayer:GetMouse().X)-2), 0, ((game.Players.LocalPlayer:GetMouse().Y)-2))
end)

2 comments
Line 14. CFrame:inverse() with lowercase i
Inverse can be capital or lowercase. It works either way.