Handling Animations on Client Issue

This is gonna be hard to explain, but. I handle animations on the client. By firing a remote event from the server to the client. Because client replicates yada yada easier server load. But a main issue that I have is that, I want to make certain things happen when a marker is reached in the track. But I have no way of accessing that track. I was thinking I could get all playing tracks. But I can’t check the track name or It’s originating animation.

I tried using a remote function to return the track but that didn’t work either.
So I’m here. How would I,

  1. Fire the Client and Animate the Player,
  2. Retrieve the animationtrack
  3. Fire whatever when the marker is reached.
3 Likes

here are some things you can try

  1. play the animation on the server to save yourself the trouble, it doesn’t make that much of a difference (especially if you’re trying to sync two player animations)

  2. listen for the marker on the client then fire a remote event to the server

  3. this is unreliable and I don’t recommend it, but it may work in some cases which is removing the marker and instead waiting a certain amount of seconds on the server

1 Like

couldn’t you just contain the animation track in a variable in the local script playing said animation and use Animation Events to fire whatever you want to when a specific marker is reached like so

Local Script

local ANIMATION_ID = 1234567890

local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local animationTrack: Animation = animator:LoadAnimation(ANIMATION_ID)

-- make sure to wrap this inside of the OnClientEvent recieving the Remote from the Server!
animationTrack:GetMarkerReachedSignal():Connect(function() -- reference the Name of the Animation Event you made within the Animation inside of GetMarkerReachedSignal()
	-- fire to the server here
end	

animationTrack:Play()

this should accomplish what you described… let me know :slight_smile: