NPC glitching during cutscene: how to fix?

Hello, i’m trying to make an NPC play an animation to simulate a cutscene. However, the NPC keeps glitching once the animation begins.

Here’s what it does:

Here’s what it should do:

I tried everything possible to stop it from glitching: I anchor the HumanoidRootPart, I added a BodyVelocity with the maximum MaxForce, I tried with a BodyPosition, none seem to work. It’s driving me insane, it makes no sense.

Here’s my current code (server):

local Character = workspace.Character
local Animator = Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local Track = Animator:LoadAnimation(script.Cutscene);
local Root = Character:WaitForChild("HumanoidRootPart");
local BV = Instance.new("BodyVelocity");
BV.MaxForce = Vector3.new(1e8, 1e8, 1e8);
BV.Velocity = Vector3.new(0, 0, 0);
BV.Parent = Root;
task.wait(1);
Root.Anchored = true;
Track:Play(0.1);
task.wait(2);
Character:PivotTo(workspace.NpcSpawn.CFrame);
BV:Destroy();
Root.Anchored = false;
4 Likes

Have you tried uploading the animation to Roblox? Just go to your KeyFrameSequence, left click and save to Roblox, then just add this:

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://numbershere"

Yeah it’s an animation instance i’m loading through :LoadAnimation()

Is the animation uploaded to Roblox?

if you already have the animation make the character jump down, you do not have to velocity as the animation will offset even more, simply change the position of the humanoidrootpart after the animation has ended and remove the velocity part as you do not need to move the character while the animation is playing

edit: make sure your humanoid root part is unanchored too

Yes, it’s uploaded on the group I own with an Action3 priority,

If you mean the BodyVelocity, I added it just to keep the HumanoidRootPart in place while the animation plays. It doesn’t affect the NPC’s velocity, in fact it’s made to make the character have no velocity.

pretty sure you do not need to do that, otherwise it might not work as intended as seen in the example, also make sure your humanoid root part is unanchored

If I remove the BodyVelocity and keep the HumanoidRootPart unanchored the whole time, this is what happens:

Code now:

local Character = workspace.Character
local Animator = Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local Track = Animator:LoadAnimation(script.Cutscene);
local Root = Character:WaitForChild("HumanoidRootPart");
task.wait(1);
Track:Play(0.1);
task.wait(2);
Character:PivotTo(workspace.NpcSpawn.CFrame);

No idea why that is happening, something else in your game, I presume?

I’ll try doing the same on an empty baseplate. I’ll see how it acts there.

Same result, except this time the NPC gets destroyed as it teleports under -500, after teleporting to its spawn point.

My only guess is that it’s related to the animation itself glitching the Motor6Ds somehow. I’ll try to change it up a little bit, if nothing works i’ll just manually animate the NPC through CFrame. Painful and probably laggy since it’s on the server, but the only solution I have in mind right now.

Why are you using the maximum force, have you tried lowering your force?

So the HumanoidRootPart stays in place. Since anchoring it didn’t work I thought adding a BodyVelocity would help out but nothing really changed.

1 Like

Take out bodyVelocity and pivot point. Make Character HumanoidRootPart Anchored. Make sure the player is in the same starting position as the rig you used for the moon animator animation before you start anim. So the anim plays in the right position. Also make sure the priority of the anim is action so it overrides player anims.

Found a solution. I set Humanoid.AutomaticScalingEnabled to false and now it’s working perfectly fine.
Someone reported it as a bug, as it effectively acts like one:

If it’s a bug, it hasn’t been fixed yet.

I personally believe it’s either a bug or just a unlogical way the engine works with animations. And yea it hasn’t been fixed as, since i posted that, nothing has changed.