Need help with replicating tools animations to viewmodel

im trying to check through all animations playing on the humanoid then checking if the id’s match with any of the animations inside the tool, and if it does then play once, then dont play any currently playing animations and cancel current viewmodel animations if theyre not playing on humanoid

is this a good way to do it and how would it be written? let me know if it needs more explaining cause its complicated

If you want an animation to play on the viewmodel at the same time every other player is seeing it why not just call a function that runs the specific aniamtion to the viewmodel as well as the player when they do something. e.g If a player presses reload (im guessing its a game about guns) then the humanoid runs the animation with the name “Reaload” and then you run a function that runs the same animation on the viewmodel

would firing an event to the client be a good method for this? would it cause issues for the viewmodel if the servers laggy?

Where are you controlling the animations? Server or client?

It switches between the client and server, I’m just gonna make a function that works for both, thanks for the idea

is there any downside to playing all animations through client? should there be anytimes where i should play it on the server? Like for shooting, since it relies on serverping for the bullet tracers and damaging the other player, should the animation be played through a serverscript to sync up with the events or would it work fine?

I think you should probably work all animations through client and when you want to apply something that needs the server (like bullets for example) you do the animation on the client as well as fire the bullet from the client while at the same time firing a remote event to the server that fires the bullet in the server. What that will do is, because of Network Ownership, the player that shot the bullet will see it shoot instantly when clicking (the bullet the shooter sees is only replicated in his screen) while others will see it after a short period of time, when the actual bullet is fired (when the server shoots it). Consequently, players will have a smooth experience and the gameplay would feel more organic rather than lagging every time you shoot a bullet. You can apply this method to any animation that requires something from the server.