Why should we use localscript to drive the car instead of serverscript?

Like the question, i would want to ask why do we need localscript to drive the car instead of serverscript?

1 Like

You prob want the user to be able to control the car but you can use both at the same time

Sever scripts do not have access to the user’s keyboard, mouse, camera, touch screen, game pad, etc.
So if you need to create, for example, a “parking brake” for a car (typically space bar) - you need a local script to read that input.

2 Likes

You don’t need to use a local script.

To add on, vehicle seats only detect W, A, S, D keys. So if you want to control a car with another type of input, a local script is the answer.

1 Like

Actually, you can get user input with a vehicle seat which is on the server.

Depends on the situation, if you wanted the car to only do driving you could just use a server script

but the reason why some cars use local script is to have more control on the client, ability to wide range of input, and to add some stuff that’s not normally in a vehicle seat

1 Like

It’s relative, ServerScript is used in cars to get more user monitoring, but it’s not favorable for high ping users.
However, LocalScript is only used to drive the car, it is more favorable because it has no latency.

5 Likes

It’s more better to use LocalScript (Reason is because of no latency).

When you’re using a ServerScript for your vehicles there is (at times, VERY noticeable) latency & it could be annoying for those with high ping.
(imagine trying to use a vehicle and it takes 1-3 seconds for the steering & throttle to register to the server.)

LocalScripts are also better because you can add keybinds for headlights, sirens, etc.

2 Likes

Not just that but the biggest point is of ping. When you use server scripts all that data has to be sent across the world and back, twice, before you see that effect on screen often leading to input delay/lag by players.

Local scripts allow us to simulate it locally so the player hits a key, it happens on their machine then everyone else plays catchup. Thereby removing input lag for the player and everyone else can receive it at the normal speed.

1 Like