Problem with playing animation track


I have a problem with playing an animtrack, it seems to have no problem before, but i changed some script and it just returns an error :
image
the location seems to be correct too:
image
Anyone know how to fix this?

Try to do this

local function CharAdded(char)
character = char
humanoid = character:WaitForChild("Humanoid")
animtrack = humanoid:LoadAnimation(anim)
end

if player.Character then CharAdded(player.Character) end
player.CharacterAdded:Connect(CharAdded)

The character might not spawn before the script runs, making animtrack remain nil

ty this now works for me! (character requirement)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.