Animation not Playing

Hi Everyone,

Im very new to animating objects that are not players, I’ve made a simple gun system but when I try to play the animation it doesn’t play:


Gun Animation Clip


Gun Animation Not Playing Video


Here is the layout of everything:

image

And Here is my Code:

local ViewModel: Model = Camera:WaitForChild("ViewModel")
local VM_Gun: Model = ViewModel:WaitForChild("Gun")

local VMGunAnimator: Animator = VM_Gun:WaitForChild("Humanoid"):WaitForChild("Animator")
local VMGunDBAnim = GunAnimationFolder:WaitForChild("GunShot Debounce")

local function GunDamage(Bullet)
	
	local VMGunTrack = VMGunAnimator:LoadAnimation(VMGunDBAnim)
	VMGunTrack:Play()

end

Help would be greatly appreicated!

3 Likes

Im not entirely sure whats wrong based off of your script, but try moving your variable for VMGunTrack outside the local function and test it again.

2 Likes

moving it outsidde didn’t work sadly : (

Are there any errors in your output?

no errors, it just strangely doesnt play the animationj, i even added lots of print statements but everything seemd normal to me.

I know this might be a dumb question, but does your animation in the folder have the ID in it?

yes it does have the animation ID it in :+1:

Do you call your function GunDamage()?

and if so, have you tried adding a print statement in that function to see if it runs through it?

yeah I did everything, strange why animation not playing cause I can’t find anything wrong with it.

If you want to add me to your studio I can try to see if I can fix the issue.

what is ur dc i can add u there

kimurica

/////////////////////

I think the solution to this problem would be calling the “GunDamage” function in the script. To do this, you just need to add “GunDamage()” and put the parameter “Bullet” inside the parenthesis.

nvm I found the solution, the gun parts were anchored so the animation wouldnt play

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.