Hello, I am creating gun animations for my project. However, when trying to input an idle animation in studio testing, it doesn’t play:
This is what it is supposed to look like:
It plays as intended in the animation editor. Anyone got any ideas?
This is the code that includes the animation:
function setupviewmodel(weapon)
print(weapon)
WeaponData = require(GunModules:WaitForChild(weapon))
maincf = WeaponData.MainCFrame
rotationcf = WeaponData.RotateCFrame
larmcf = CFrame.new(1,-1,-2)
larmrotatecf = CFrame.new(0,0,0)
rarmcf = CFrame.new(1,-1,2)
ammo = WeaponData.ammo
maxammo = WeaponData.maxammo
remaining = WeaponData.remaining
reloadspeed = WeaponData.reloadspeed
Animator = GunViewmodels.Shotgun.Humanoid.Animator
Idle = GunViewmodels.Shotgun:FindFirstChild("Idle")
WeaponInHand = GunViewmodels:WaitForChild(weapon):Clone()
WeaponInHand.PrimaryPart = WeaponInHand:WaitForChild("HumanoidRootPart")
WeaponInHand.Parent = cam
for i, part in pairs(WeaponInHand:GetChildren()) do
if part:IsA("BasePart") then
part.Anchored = false
part.CanCollide = false
end
end
LArm = WeaponInHand:FindFirstChild("Left Arm")
LArm.PrimaryPart = LArm:FindFirstChild("LeftArm")
RArm = WeaponInHand:FindFirstChild("Right Arm")
RArm.PrimaryPart = RArm:FindFirstChild("RightArm")
LoadIdle = Animator:LoadAnimation(Idle)
LoadIdle:Play()
print("Idle is playing")