I have an AI character that is supposed to walk toward you, and play an animation. It does this, but just spams the first few frames of said animation, and then stops.
anim = Instance.new("Animation",script.Parent.Parent.Humanoid)
anim.AnimationId = "http://www.roblox.com/asset/?id=5063671356"
humanoid = script.Parent.Parent.Humanoid
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
local playAnim = humanoid:LoadAnimation(anim)
playAnim:play()
end
end
script.Parent.Touched:connect(onTouched)
any help?
EDIT: This script is located in the models upper torso if that is any help.

3 comments
did you set the animation priority to action?
I'm very new to animation and coding in general. but how would I do that?
please use :Connect() and not :connect()