While it technically isn’t an “NPC”, the basic gist of it is that I’m attempting to find the player’s current animations and then duplicate these onto a duplication of said player, which will function as an NPC. I’m able to duplicate the player and all fine, however I’m seemingly unable to duplicate the animations. I’ve read into the wiki and doing Humanoid:GetPlayingAnimationTracks() would output a table value of all the animation tracks playing. I use a pairs loop in order to go through each of the animation tracks, getting their animations and then running those animations onto the NPC’s character. While there are no visible errors in the output, it doesn’t seem to have any effect. I’ve also tried using an animation controller, duplicating the animation track’s animation Id to the controller and then playing that under the NPC’s model. Both have no visible effect. Am I unable to use an animation track’s animation ID as it’s a “Read-only” value? Here’s my code, if there’s any errors, feel free to enlighten me!
(Just to be clear, I’m running this from a server-side script within the player’s character model)
for i, track in pairs(Character.Humanoid:GetPlayingAnimationTracks()) do
--[[local animControllor = Instance.new("AnimationController", AfterImage)
local t =animControllor:LoadAnimation(track.Animation)
t:Play()--]]
AfterImage.Humanoid:LoadAnimation(track.Animation)
end
The commented code was used for animation controller, whereas the current code uses it directly into the Humanoid.