local Attackanim = script.Attackanim wait(1) local vPlayer = game.Players.LocalPlayer local character = vPlayer.Character local humanoid = character.Humanoid local AnimationTrack = humanoid:LoadAnimation(Attackanim) local mouse = vPlayer:GetMouse() mouse.Button1Down:Connect(function() AnimationTrack:Play() end)
Please help me, the error code: Players.mittomen28.PlayerScripts.AnimationHandler:7: attempt to index nil with 'Humanoid'
Also, this is a local script (ofc)
Attempt to index nil with humanoid. From this we should know that the character is the one with a nil value meaning the character isn't there. Sometimes the script loads in before the character does and whent he script runs, there wont be a character yet. You can solve this by waiting for the character to join if there is none.
if not character then character = vplayer.CharacterAdded:Wait() end
It should work if you insert this between lines 6 and 7