My partner and I have been working on our project lately, and are needing to make cutscenes with our different NPC characters walking, running, or doing something in the background, etc. I thought tweening might work but so far I’ve got no luck.
Any tips on how to animate cutscenes?
Thanks
-Imagine
If you are talking in specific about camera movements, it may be worthwhile creating a module in which you feed in a table of tween positions, and it tweens for you.
On the topic of NPCs, you can use Animator:LoadAnimation() to load in the animations. (You could also pack info onto the same table as mentioned above, and write logic in the module to animate said characters)
1 Like
On the topic of NPC’s.
On the code “Animator: LoadAnimation()”, where would I put an animation ID to know when and what it plays?
This article should help you. However, Humanoid:LoadAnimation
is now deprecated and any place that calls functions for the humanoid should be replaced with the Animator
.
If what I said in that last sentence was confusing for you, read this post at the section “Reccomended Alternative”.
1 Like
Animator:LoadAnimation()
takes an Animation Object. Create one in studio or by using Instance.new("Animation")
and set Animation.AnimationId
to your animation ID, and then use it in Animator:LoadAnimation()
. Here is an example script:
local Animation = Instance.new("Animation") -- Create a new animation object.
Animation.AnimationId = "rbxassetid://0" -- This is NOT a valid animation id, just an example.
local Animator = Humanoid:WaitForChild("Animator") -- Waits for the Animator object to be put into humanoid, assuming you already have the Humanoid.
local LoadedAnimation = Animator:LoadAnimation(Animation) -- Loads the animation.
LoadedAnimation:Play() -- Plays the animation.
Just make sure when using animations, you use Server Scripts to run animations on NPC’s or other objects, and use LocalScripts to run animations on players.
3 Likes