It may be that it's in a local script, but the following lines should play a custom animation I made. It works for me, but none of my friends see the animation. Any ideas why?
local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play()
Make sure the animation is in YOUR inventory. Also if the game is a group game make sure the group owner has the animation in their inventory. I had this problem a while back and It happened to be that the animation was in the group inventory which only displayed the animation for people who are in the group
Consider this:
A localscript is client sided. Meaning it runs on your device. All games default to Filtering Enabled to reduce the exploiters making on the news, as such we have two sides, Server sided and client sided. Server sided scripts (or just a regular script.) uses code visible towards everyone. Difference being that the client sided events can't be activated to trigger events from players, like pressing a key, because it stays at the client sided. If you want to play an animation for everyone to see, transfer your code to a regular script, but if you need to trigger events from the client to end up in the server, use Remote Events and/or remote functions.
https://developer.roblox.com/articles/Remote-Functions-and-Events