Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Make a Touchpad that will make the animation run?

Asked by 6 years ago

can someone teach me how to make an touchpad that someone will touch it and the animation will run on the npc

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

If you have a part in workspace called TouchPad and your NPC has a humanoid, this should work in a script inside the NPC:

local anim = Instance.new("Animation")
anim.AnimationId = ""--enter id inside quotes
workspace.TouchPad.Touched:Connect(function(hit)
   if hit.Parent:FindFirstChild("Humanoid") then
      local track = script.Parent.Humanoid:LoadAnimation(anim)
      track.Priority = Enum.AnimationPriority.Action
      track:Play()
   end
end)
Ad

Answer this question