AI Trains in FiveM

Okay so I’ve spent a few hours today looking for anything on AI trains in FiveM, specifically on a FivePD server. I tried the resources I could find, that being the Feb 2019 release by VenomXNL, also the original script he worked from and another very basic client side script. VenomXNL script throws an error when a client joins the server and I see he is no longer doing anything with FiveM so can’t hope for assistance from him. But is there anyone with AI trains working in the said environment?

I host the FXServer through Zap-Hosting but also run a test server on my own PC. Any advice or guidance would be greatly appreciated.

The following resource spawns trains and trams, if you don’t want the extra stuff you can just copy line 38 - 45 as that part tells GTA to spawn trains naturally


Awesome, thank you sir. I’ll give it a go.

Sorry to bump an old post. But I really like this, but I found a small annoyance. The train horn uses the emergency vehicle horn sound. I’m looking for a way to teach the trains to sound like a train.