How to handle custom keybinds for a vehicle

I been wanting to create some chassis for different vehicles and recently made a car chassis, i initally just used the throttle and steer values of the vehicleseat to control it on a local script. but now I want to control the car on the client by using NetworkOwnership since it would allow me to use custom keybinds, only problem is how do i exactly do it? i tried just using a regular script with it’s runcontext set to client but it would start controlling any vehicle that was nearby the player.

I tried looking into the A-Chassis scripts to see how they did it but i can’t seem to find the script that actually handles the controls.

Does anyone know how to handle client side keybinds for vehicles like a-chassis?

To be specific i want the scripts to be in the chassis itself and not in the player containers (StarterPlayer, StarterCharacter, etc…) which is why i initially tried using a script with a client RunContext instead of a regular local script

1 Like

I am not sure I understand what you are looking for.

A keybind setup look something like this:

local LeftShift = Enum.KeyCode.LeftShift
local RightShift = Enum.KeyCode.RightShift
local Gamepad_Left = Enum.KeyCode.ButtonL2

local function ShiftToggle (player, state, input)
	if state == Enum.UserInputState.Begin then
		Client_To_Server_RemoteEvent:FireServer("Shift", true)
	else
		Client_To_Server_RemoteEvent:FireServer("Shift", false)
	end
end

ContextActionService:BindAction("ShiftKey", ShiftToggle, false, LeftShift, RightShift, Gamepad_Left)

Posting some sample of the script you are having trouble with might help.

1 Like