I made a viewmodel thats supposed to play a animation. However, It doesnt play.

script:

local realgun = game.ReplicatedStorage.PlayerHandgun
local cam = game.Workspace.CurrentCamera

local gun = realgun:Clone()
gun.Parent = cam

local anim = gun.Humanoid:LoadAnimation(gun.Idle)
anim.Looped = true
anim:Play()


game:GetService("RunService").RenderStepped:Connect(function()
	gun:SetPrimaryPartCFrame(cam.CFrame * CFrame.new(-0.5,-2,-2))
end)

No errors found.

2 comments

0

There is a bug with looping animations and replicating them to players.

0

also make a variable of CFrame.new(-0.5,-2,-2) it is a constant value