I'm trying to make a sword that plays an animation when you click. But I get an error. (Stated above in the title) It's a serverscript inside of the gear.
local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play()
Any answer that actually works is fine.
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.
-- In LocalScript 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()