How would I make ai car chase me

I’m not to good of a programmer and I looked for other topics on this, I couldn’t find any. I’m trying to make a police system, but for now just make car chase a player in-game.

Would anyone be able to help?

1 Like

I would use tweens to make a car chase you, that should work. Having the tweens target CFrame be you root part CFrame - CFrame.new().

Edit: Or you can use pathfinding and insert a humanoid into the model.

1 Like

I Think Try Learning Neural Network Library It Will Be Very Efficient For Your Police System
(And Very Cool!)…

So You Can Make A Real A.I

Wait that can work? Because I remember putting a humanoid into a model for a follow script and it did nothing.

The concept of chasing is really complicated because you are looking for a system where there’s a policeman chasing you, the policeman needs to make decisions, keep a distance or try to make you crash. What you should first look into is pathfinding, once you can make a car go wherever you want (In a way that makes sense) You have to look into how to make a game AI and try to think of the different behaviours it’s going to need, program those in the game and have an algorithm pick which behaviour the police car should follow based on the situation.

This is a very advanced scripting problem, which is the reason why you never see this kind of stuff on Roblox. Even I, with 6 years of professional experience, would struggle to make something like this functional without a ton of research. It may not be the best idea to make this particular thing if you’re not advanced, but if you really want to push through, start researching pathfinding, pathfinding for cars and broad concepts which you can turn into code, but it’s going to be very hard. Don’t look for roblox stuff, you can find a lot more resources in communities like Unity and Unreal, or gamedev in general. Learn there, and once you understand the math and the logic behind making something like this, give it a shot.

Good luck man.

4 Likes

Maybe that would be useful? However, path finding would not work very well with it. @HackItsGood’s suggestion would probably be ideal.

Actually, making a car chase a player is not that hard. Just by taking this model from here How would I make a brick follow a certain path as if it is moving like a car? - #8 by Someone12132 , using a while loop, modifying some things and adding an AI figure (please don’t judge my terrible code :frowning: ) you can have an operational car chasing a moving figure like this one (I have not tested whether you can do the same with a player, but you can surely make the car chase an other car; not without problems though).

Now, if you need the car to be able to predict where the player wants to go, locate/chase the nearest player and do lots of other stuff(ex. obstacle avoidance) you will need pretty more than this. Sorry for the bump

Well while Neural Networks are really cool, they have several drawbacks that you need to take consideration of. Some of them are pointed out in this post :


Nevertheless, even if you decided to use NN it would be really hard considering the lack of information , tutorials, experience etc.

3 Likes