I want to make it so when I touch a certain part,an animation plays in a certain npc. I found a script on the web but I don't know how to use it or if it is right. Btw I'm terrible at scripting.
local part = --write here
local animation = --write here
local animationTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animation)
part.Touched:connect(function(p)
if game.Players:GetPlayerFromCharacter(p.Parent) = game.Players.LocalPlayer then
animationTrack:Play()
--add more code
end
end)

7 comments
Thank you very much! If you have time, how do I make it debounce?
Im sorry i dont get it, what exactly do you mean with debounce?
https://www.youtube.com/watch?v=-wybT5u38L0&feature=youtu.be
It like glitches out when I move on the block
Oh, now i get it.Try replacing this script with the one i sent you: https://pastebin.com/UCbNh3c8 You can change the number at line 12, it is the amount of time you have to wait until you can make the npc do the animation again.
Thank you man, very much appreciated.
No problem, Have a nice day!