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.
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?
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.
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!