Need help making a script that makes npc's Hop into cars

Im new to scripting and im in need of help, making a script that makes npc’s hop into cars within a certain radius and dropping them off at a set location. Im making a Taxi game.

What you would need to do is get the car’s position and the NPC’s position. You can calculate the distance between the car and the NPC by using magnitude.

Next, if the NPC is within a certain distance of the car, use the Humanoid:Move() function to move the NPC to the car.

The next step depends on what you want to do with the humanoid when it gets into the car but you should have an array of all the positions the car needs to be dropped off at, and once the car arrives, move the NPC out of the car.

1 Like

There are a couple of ways to do this :thinking: I think using Magnitude is what you’d want when a NPC is near a certain car, then using the VehicleSeat:Sit function you can force that NPC to be seated

2 Likes

Thank you for your suggestion <3

thank you for your help I appreciate it