I am making a NCP that start a animation when it’s toutched but my script is not working

My script is not working and I don’t get anny errors pleas help I don’t know what to do

local animation = script:WaitForChild(‘AnimationID’)

local humanoid = script.Parent:WaitForChild(‘Humanoid’)

local d = humanoid:LoadAnimation(animation)

function onTouched(part)

local h = part.Parent:findFirstChild(“Humanoid”)

if h~=nil then

d:Play()

wait(8)

end

end

script.Parent.Touched:connect(onTouched)

Please format your code by surrounding it in 3 back ticks (`) or whatever it’s called so it looks like

if true then
  -- Code
end

See Animation | Documentation - Roblox Creator Hub for details. Also, try to use capital c when doing :Connect().

Make sure your NPC is a proper rig.

Question, where is the script located? since it seems as you just placed the script in the model, and not a part in the model.