Hello. I have reached a point where I am completely lost on what I should be doing. My goal is to make a non-playable character do a animation upon a player user key press. I have gotten it to work locally on my player-controlled unit with this script.
--------------------------------------------------------------------------
Starterpack > Script > Animation
wait(2)
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Anim = script.Animation
Mouse.KeyDown:connect(function(key)
if key == "q" then
s = player.Character.Humanoid:LoadAnimation(Anim)
local animTrack = Humanoid:LoadAnimation(animation)
animTrack:Play()
s:Play()
end
end)
----------------------------------------------------------------------------
Now the issue is I'm not sure how to apply it upon the NPC character model. The character is just a copy + paste of myself. It contains the humanoid, rootpart, default animations, etc.
According to wiki,
"If your NPC has a Humanoid, you can simply load the animation and play it just like a regular player (except use a Script instead of a Localscript to load the Animations)."
But how do I specify it to work on THAT npc humanoid specifically and not my controlled player? I have tried a couple of things and I'm just confused. I have looked around but maybe I'm just dumb. I know about AnimationController but it says not to use that on a humanoid. So where do I go from here? I have no experience with scripting in my life since today. So if it's something as simple as a pathway i'm sorry.
|