I had a look at this post:
and came up with this code
local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerScripts = player:WaitForChild("PlayerScripts")
local playerModule = playerScripts:WaitForChild("PlayerModule")
local controlModule = require(playerModule:WaitForChild("ControlModule"))
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local accelerating = false
local decelerating = false
local steeringRight = false
local steeringLeft = false
local function BindContextActions()
ContextActionService:BindAction("Accelerate",function(_,inputState)
if inputState == Enum.UserInputState.Begin then
accelerating = true
elseif inputState == Enum.UserInputState.End then
accelerating = false
end
end
,true,Enum.KeyCode.LeftControl)
ContextActionService:BindAction("Decelerate",function(_,inputState)
if inputState == Enum.UserInputState.Begin then
decelerating = true
elseif inputState == Enum.UserInputState.End then
decelerating = false
end
end
,true,Enum.KeyCode.RightAlt)
end
humanoid.Seated:Connect(function(isSitting,seatedPart)
if isSitting then
task.wait(2)
--if UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled then
controlModule:DisableVehicleSeat()
BindContextActions()
--end
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
if accelerating then
humanoid:Move(Vector3.new(0,0,1),true)
print("accelerating")
end
if decelerating then
humanoid:Move(Vector3.new(0,0,-1),true)
print("decelerating")
end
end)
Everything does work fine, except it doesnt move the car.