✓ Accepted answer
(This might not be fitting specifically for your case but this is some issues I saw)
First off, you're not checking if the thing that touched the part is even a character, so it might touch a random workspace object and attempt to find the "character" of that...
Second off, you don't need to do that long path to the character, you can just get the part's parent (after you've confirmed it is indeed a character)
function OnTouch(hit)
local humanoid = hit:FindFirstChild("Humanoid")
if humanoid then
hit.Parent:WaitForChild("Anima").run.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=4958225000"
end
end
script.Parent.Touched:Connect(OnTouch)
(also using :Connect instead of :connect is recommended)
3 comments
all of that is in a script
localscript?
first you have to check if it is a character or not