How to create an NPC change angle to score a goal

So I am making an NPC that you can play against in a game I am making called Bubble Soccer Royal. But one thing I am not quite sure where or how exactly to start is making it so that when the NPC goes running over the ball (aka hit it) that it makes sure that it turns/moves to a line itself with the net so that it can run it right into the net. So far I just have it use a BodyPosition as Physics to move the Bubble to the ball.

This is NOT a cutscene nor is it something where AI just moves a ball. The AI has to move WITH the ball into the net meaning turning to make sure both the ball and the way the AI moves will head right into the net

Any Ideas?

1 Like

I’m not sure what you want to do? If you want to make the character move maybe try reading this: Character Pathfinding | Roblox Creator Documentation

1 Like

I want the character to angle itself so that when it moves forward it would hit the ball into the net. Without making some animation or the ball do it by itself.

1 Like

So you want to make it face the ball?

I want it to face the ball in an angle or a way that if it were to move forward it would go into the net/goal

Sorry at my bad drawing but something like this:

All you need to do I use look at. You need to do this for it:

Torso.Cframe.lookat(ball.Cframe)

That will just look at the ball and won’t aim it to the net.

Oh you want it to go inside the net.

I think I understand your question, so you want to make a cutscene or something basically when the npc faces the goal?, If I’m correct then here is a script I found on the forum and adjusted:

Touch.Parent:SetPrimaryPartCFrame(Touch.Parent:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(90), 0))

Change the argument in math.rad(90) to whatever angle you prefer, however I’d recommend doing some experimenting with the angles to get it right.

Yes the ball must go into the net by the NPC the NPC must direct the ball by moving it into the net.

Not quite. I want the NPC is pretty much a player AI however you want to call it that will move the ball into the net. From wherever it is

I have made something similar to this. You can create a part in the net and then use the tween service:

Okay I must make this clear. This is NOT a cutscene nor is it something where AI just moves a ball. The AI has to move WITH the ball into the net meaning turning to make sure both the ball and the way the AI moves will head right into the net.

This post should fix your problem :slight_smile: : Visualizing Bezier Curves - #42 by RiverCryptz

1 Like

You may be right I’ll look into this.

It worked. Thanks a lot for that.

1 Like