Hello, so I would like the server to be able to access the same AnimationTrack as the one that is currently being used by the client. My intent with this is that the server will execute actions when GetMarkerReachedSignal is fired in an AnimationTrack, while the client is handling the playing, stopping, etc.
The issue is that when I pass the AnimationTrack to the server via RemoteEvent, it always returns nil. Here’s what my code looks like:
LocalScript
--An animation is loaded by humanoid:LoadAnimation() and animationTrack is returned
remoteEvent:FireServer(animationTrack)
Server script:
--The RemoteEvent is received as an argument so it can detect markers
remoteEvent.OnServerEvent:Connect(function(animationTrack)
animationTrack:GetMarkerReachedSignal("Marker"):Connect(function()
--Do things here
end)
end)
This does not work because the AnimationTrack becomes nil for some reason once it reaches the server script. I read on the dev forum that the AnimationTrack has to be replicated onto both server and client first, but I am not sure how this can be achieved. Does anyone have suggestions for an alternative or a solution?
Edit: One solution I considered is that I could fire a RemoteEvent to the Server when the marker is reached on the client, but I believe this would make it easy for exploiters to fire the RemoteEvent and get their desired results through the server before the proper conditions are met. I also do not know how to check if the conditions are correct on server script because the condition in my situation is the animation finishing, and/or the time length of the animation has passed.