Why isn't my animation playing?

if not game:IsLoaded() then game.Loaded:Wait() end

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid:: Humanoid
local animator = humanoid.Animator:: Animator

local backPack = player.Backpack

local shootAnimation = script.Shoot

local canPlayAnimation = true

local function playAnimation(animation: Animation, waitAnimationCompleted: boolean?)
	if not canPlayAnimation then return end
	print("Test1")
	local animationTrack = animator:LoadAnimation(animation):: AnimationTrack
	print("Test2")
	animationTrack:Play()
	canPlayAnimation = false
	print("Test3")
	if waitAnimationCompleted then
		animationTrack.Stopped:Wait()
		animationTrack:Stop()
	end
	canPlayAnimation = true
end

local function onActivated()
	print("a")
	playAnimation(shootAnimation, true)
end

local function onEquipped()
	print("e")
end

local function onUnequipped()
	print("un")
end

for _, v: Tool in backPack:GetChildren() do
	v.Equipped:Connect(onEquipped)
	v.Unequipped:Connect(onUnequipped)
	v.Activated:Connect(onActivated)
end

Can I see the output?

1: Is it under a group? I assume not you seem to be create a solo game ???
2: output please
3: is the last for loop even working? add some prints and again, show output.

I used your code for testing and then the animation plays correctly. So, the issue is not from the script. Please check again or upload the entire .rbxl file for further assistance.

i see, its so weird… go test !!

is the game from your account and did you upload the animation’s id from your account? if you didn’t, that may be the case since you can’t really use animations without uploading it yourself

The problem is a priority problem, i just set Priority on Action

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