Hello, I have an error in my code that happens all the time when I animate it always does something like: attempt to index nil with Humanoid or attempt to index nil with Character. I'm not sure what to do anymore I used a script from not too long ago and the old script worked but the new one worked it's so confusing. I would like to say it does start in ServerStorage so that may be why. but I don't know. Anyway, This Is A LocalScript Inside of a Tool Inside of ServerStorage but it moves to the player backpack. so I don't know here is my script error is at line 1
local Anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.SlashAnim2) script.Parent.Activated:Connect(function() Anim:Play() end)
You forgot to put AnimationId at the end
local Anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.SlashAnim2.AnimationId) script.Parent.Activated:Connect(function() Anim:Play() end)
It's saying the character is ni, in other words the script is running when the character hasn't loaded yet. Either put the script in LocalCharacterScripts that way the script is guaranteed to run because the script runs when the character loads or keep it where it is and modify the script a little bit
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() --if player.Character is nil then wait for the character to be added before running the rest of the script local Anim = character.Humanoid:LoadAnimation(script.Parent.SlashAnim2) script.Parent.Activated:Connect(function() Anim:Play() end)