[Release] SecretCars > car only in local need to be fix

I have the jumping issue @SorensenDK has mentioned. Say you have two players on a server, Player 1 and Player 2. The cars spawn on each of the players screens.

If Player 1 enters a vehicle and drives around, Player 2 does not see the car Player 1 is entering. Player 2 sees Player 1 spazzing out and jumping around.

The cars are only spawning locally for each client. You need to enable the isNetwork argument to true when spawning the car. However, I did that, but now it spawns multiple cars (one for each player).

I’m thinking (to avoid multiple cars) have a variable on the clients for something like areCarsSpawned. When the script wants to spawn the cars, it will check if that variable is true or not. Once the cars spawn once, it will trigger an event on the server and then trigger an event on all clients setting that variable to true (only causing it to spawn for the first person).

That could cause issues, however. For example, if you have two people loading at the same exact time (or if you restart the resource) the script will be run at the exact same time. So it will not have enough time to trigger the events and set the variable. Another check could possibly be added in to see if the car of that type exists at the location just to avoid the 2 people connecting at once issue.