: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.

Have you figured this out yet? I’m also experiencing this issue

Sorry for the late reply, I never tested this as I have moved on to another project. Might be good for you to upload a game to a group and try uploading the animation(s) there as well, then try doing the :GetMarkerReachedSignal() for the NPC. I believe that’s the issue, but it has to be tested. Update me on what happens!

It’s all good, I think I had a completely separate issue for me, might as well explain it even tho it probably won’t help

it was to do with my own animations module and how I preloaded animations on npc’s animators which I found out is bad practice because I think preloaded animations on server sided animators can just stop existing on the server
(take that with a grain of salt, that’s just what I think)

so now I use another method where I preload animations on the Server itself just once when it loads and obviously on Clients when they join, far simpler and works. Which also means my animations module now just handles overlaps and loads animations the normal way
which is just :LoadAnimation() on an animator now, instead of finding an animation from a table of preloaded animations because it doesn’t preload anything in itself anymore, so :GetMarkerReachedSignal() works for me!!

I don’t explain stuff often so it might seem confusing, ask questions if needs be
Not sure if my explanation will help anyone, but if it does, feel free to update me about it!