That function just check if a vehicle has a trailer attached.
You need to loop through every vehicle to see if the trailer is attached.
Well, he was saying that every vehicle (including attached trailers) were being respawned. So using that to check if it's attached to a vehicle won't make the trailer respawn.