:GetMarkerReachedSignal() not firing for an npc, but works for regular players?

Hi DevForum, the title is self explanatory. I will provide a snippet of my code:

function CombatServerModule:PlayAnimation(action)
	if action == "M1" then
		local animation = self.Animations[(self.Weapon).. (tostring(self.Combo))]

		if animation then
			for i, track in pairs(self.Animations) do
				track:Stop()
			end

			animation.Priority = Enum.AnimationPriority.Action4
			animation.Looped = false
			animation:Stop(0)
			animation:Play()

			return animation
		end
end
end
local Animation : AnimationTrack = self:PlayAnimation("M1")
					
					Animation:GetMarkerReachedSignal("hit"):Once(function()
						local Detected, Results = self:Hitbox()
						
						if Detected and Results then
							self:Combat(Results)
						end
					end)
					

Let me add that the animation plays, but never reaches the “hit” marker apparently. I tried looking around and saw some advice such as upload assets under a group, but I would like to hear anything anyone has to say about this.

If you dont have the right group access to the animation then it wouldnt play at all and you would probably get an error in the console

Maybe fire a remote event from the server and then play the animation from the client

1 Like

:white_check_mark: TL;DR Fix Checklist:

  • NPC has a Humanoid > Animator
  • You use Animator:LoadAnimation() properly
  • The animation has a "hit" marker
  • The animation is uploaded by the game/group owner
  • You don’t reuse AnimationTracks
1 Like

So essentially upload the assets under a group and play animations from client? It’s an NPC though, how would I play an animation from the client then get the hitmarker for it?

if the game is under your profile the animations should be under your profile
If the game is under a group it should be under the group

I think now its a bad idea to play animations from the client because you have to run serverside code on the event anyways

try checking everything the other guy said

1 Like

I appreciate your reply

The game is already under my profile and so are the animations. I have the animations playing on the server the same way it plays for the character, but I did like look into things and it was recommending to do it under a group instead, but I don’t know how accurate that is.

Have you tried using ‘KeyFrameReached’ as an alternative since the signal doesn’t fire? You can also try moving the SignalReached function within the :PlayAnimation function above the line ‘animation:Play()’ to ensure that the signal is established before the animation plays.