I'm making a Aim Trainer game and I'm using an NPC as a dummy. How do I make the NPC look at the player while jumping and moving around side to side?

So, I’ve already made everything in the game work pretty well, but the main thing I am trying to achieve is making the NPC face the player while the NPC is strafing side to side and jumping up and down.

I’ve tried looking through many other posts and all of them told me to change the CFrame of the HumanoidRootPart of my NPC and none of those work either. my NPC jitters around and just jumps up and down and does not move side to side.

This is really all I need to complete the main stage of the game I’m working on.

1 Like

use Tweenservice and tween the orientation of the HumanoidRootPart Or Lowertorsos (Don’t know which one right now due to me not being at my pc) Orientation to the player. This should give a smooth non jittery look.

Thanks so much! I’ll try this right now

Sounds good just let me know if you need anything else / more help!

Seems to just teleport my NPC to the orientation of my humanoidrootpart.

Scripting isn’t really my thing.

Can I get an example?

1 Like

Yeah of course I can give you an example, do you mind explaining to me a little more on what you’re trying to achieve however? So I know what to create?

So I spawn In and there’s an NPC moving back and forth from one point to another while jumping up and down. The NPC also holds a gun of some sort that I want the NPC to aim at you while moving around. I don’t just want the NPC to move side to side looking the direction its moving. I want the NPC to have a kind of first person or “shiftlock” look at the player.

Thanks.

No problem, ill try my best to give you a working version in a bit.
Just need to help someone else with a beam script. Ill reply once done.

No problem! Take your time :slight_smile: and thanks for your help!

Your game sounds super interesting! I would love to play it when released where am I going to be able to find it?

Mind giving me the script you’re using so I don’t have to re-create it? And So I can just add onto it.
Funny blooper im working on :
robloxapp-20230105-0138539.wmv (591.3 KB)

Lookin good!

Hope I don’t glitch my NPC again and make it fling into outer space.

That’s the thing, I have multiple scripts in my dummy that are organized.

Such as,

Clone - (Clones again after death)
Shoot - (NPC shoots back at opposing players WORKING ON)
Jumps - self explanatory

and FacePlayer, which is empty lol.

and the video you sent me seems pretty well so far.

1 Like

I have no idea yet. I have no name or any idea of how I want to style the entire game.

I started this game not even 8 hours ago.

Hopefully I can release it soon lol

Oh lol, and here I was doing it all in 1 script.


I assume it is local right?

-Dont mind the last line, was just testing something

The other scripts are server scripts, the faceplayer one I planned to make a local

You think I can check out that tweenservice line? that might be all I need

yeah let me just test it really quickly on a server side and see if it works for you.

1 Like

local l__Position__49 = workspace.R15.HumanoidRootPart.Position;

	game:GetService("TweenService"):Create(game.Workspace.R15.HumanoidRootPart,TweenInfo.new(.1,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{CFrame = CFrame.new(Vector3.new(l__Position__49.X, l__Position__49.Y, l__Position__49.Z), Vector3.new(player.Character.HumanoidRootPart.Position.X, l__Position__49.Y, player.Character.HumanoidRootPart.Position.Z))}):Play()

Awesome!! Thank you so much!!

Let me give this a try

sounds good! Let me know how it comes out

I have accomplished this using ApplyAngularVelocity on the root part, using the following code:

torso:ApplyAngularImpulse(Vector3.new(0, torso.CFrame.LookVector:Angle(CFrame.lookAt(torso.Position, targetPart.Position).LookVector, Vector3.yAxis) * torso.AssemblyMass * 50, 0))

It works best when AutoRotate is disabled.

2 Likes