✓ Accepted answer
You should run this animation on a localscript. Player characters have an animator inside of their humanoids. This is for the purpose of client-server replication of animations. Meaning, you can play an animation on a localscript on the client and it will still be able to be seen by other players.
Furthermore, if you are going to run this in a localscript, I suggest you yield until the player's character exists, because it takes some time for the character to load.
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player:WaitForChild("Character")
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://..."
local AnimTrack = Humanoid:LoadAnimation(Animation)
AnimTrack:Play()
10 comments
Maybe try local script?
Then it won't appear on other people's screens
ok what 3k views and no answers
ikr
It's probably just bots.
maybe try: local animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Animation) , idk i havent try it
@The_Saver31 That leads to the starterpack.
I believe it is a Server/Normal script. And the thing to note in the server/normal scripts, is that there is no Local Player, it is indexed as nil (as server doesn't work for any particular player but for all players). And in order to fix it, you can just get the Parent of your tool, because if you activate/equip the tool if gets moved to the player's Character., to get the player's character.
Finally someone who gets it ^ ;)
Don't answer the question in the comments.