I want to play a animation on a NPC so when he dies it plays, I have tried looking on google still can’t find a answer.
2 Likes
You could make an event that listens for the NPC’s Died event, then play the animation. You should try and make sure the BreakJoints property of the humanoid is off.
1 Like
How would the code look like? and where would the event go?
You can put the code in StarterPlayer → StarterCharacterScripts (make sure it is a LocalScript)
Then, set up your variables for your character.
local character = script.Parent -- Scripts under StarterCharacterScripts are automatically parented to your character when loaded
local humanoid = character:WaitForChild("Humanoid") -- The Humanoid has the .Died event
humanoid.Died:Connect(function()
-- Your function
end)
You could also look at YouTube videos for more help, since they usually go over these types of questions.
1 Like