Basically, I’m trying to make a race start system, and I want to make it so the driver can be in the car but the car is in neutral (so they cant jump the start), and when the race begins, I fire a remote event or something to make the car not forced in neutral anymore.
How would I do that?
Hello there
I was facing a similar problem when using A-Chassis for my self driving cars.
The way I figured it out to change modes/ gears/ etc. was by editing the drive
script (LocalScript) of the A-Chassis.
The drive
script controls the user-inputs: turning, braking, accelerating, shifting gears.
If your racing game uses no automatic transmission, you could get away with adding a new variable (force_neutral
for example) in that script and add it to the if-statements that regulate the up- and down-shifting.
-- psuedo code
if input == UP_SHIFT and not force_neutral then
....
if Input == DOWN_SHIFT and not force_neutral then
....
You then add a RemoteEvent to the car and reference it in the drive
script:
Note that the RemoteEvent does not have to exist in every car, it can be referenced from the ReplicatedStorage as well.
-- pseudo code
local force_neutral_event = game.ReplicatedStorage.ForceNeutralEvent
force_neutral_event:Connect(function(state: boolean)
force_neutral = state -- either "true" or "false"
end)
You can then use a server script to send a message to the RemoteEvent:
-- pseudo code
game.ReplicatedStorage.ForceNeutralEvent:FireAllClients(true) -- force neutral on every car
game.ReplicatedStorage.ForceNeutralEvent:FireAllClients(false) -- enable shifting on every car again
If your racing game uses automatic transmissions then you kinda need to take a look into how A-Chassis handles that. Nontheless, it should look/ work similar to my example.
Hope this helped you out.
Feel free to ask questions, but note that I have to go thus I might not be able to responde in the next hours.