AnimationTrack not found in a table(animator one) even if it exists

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to do fly script with 2 anims, one is movement second is idle
  2. What is the issue? Include screenshots / videos if possible!
    Code not founding AfkAnimation even if it exists in table and just override afk anim and restarts it
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? this is some issue with table ig

Code:

UIS.InputBegan:Connect(function(input, gameProcessed)
		while UIS:IsKeyDown(Enum.KeyCode.W) and Char.Configs.CanFly.Value == true do
			for _,anim in pairs(Char.Humanoid:GetPlayingAnimationTracks()) do
				if anim.Name == "FlyAfkAnim"then
					anim:Stop()
				end
			end
		LoadedFlyAnimation:Play()
		rs.Stepped:Wait()
		bp.Position = root.Position +((root.Position - camera.CFrame.p).unit * speed)
		bg.CFrame = CFrame.new(camera.CFrame.p, root.Position)
		end
		local anims = Char.Humanoid:GetPlayingAnimationTracks()
		if not table.find(anims, "FlyAfkAnim") then --here it don't found anim even if it exists
			print("not found")
			print(anims)
			LoadedAfkAnimation:Play()
		end
	end)
1 Like

Your afk animation is not being found because you’re searching for a string, not an object.

You may have to go through the whole table and check the names or change the table to have the names of the objects as strings instead of objects.

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