I want to make a Animation Trigger for a horror game. So when Player steps on a part, a NPC will do an animation.
Can anyone help me?
In the same way you use :LoadAnimation() on a player's humanoid, you'd use it on an NPC's humanoid inside a touch event. So once touched, use :LoadAnimation() on the NPC and then just :Play() it.
Here is something that will help you. Replace the animationID variable with your own animation id.
local part = script.Parent local NPC = game.Workspace.NPC local animationID = 1338744180 part.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then --checks if hit is a player local Animation = Instance.new("Animation",NPC) Animation.AnimationId = "http://www.roblox.com/Asset?ID="..animationID local LoadedAnimation = NPC.Humanoid:LoadAnimation(Animation) LoadedAnimation:Play() end end)
Enjoy and thanks for posting.