I am attempting to make a walker vehicles for my upcoming game. The player should be able to sit down in the driver seat and drive the walker around on the walker’s local axis with :VectorToWorldSpace() so that it works like a normal Roblox vehicle. I have added this script to the walker seat so that when sat down it puts it into the players’ character and allows them to move, the only problem is that when the player presses a movement key it doesn’t move at all. Not sure why as I don’t receive any errors from the output. Can someone please identify the problem in this script and suggest or tell me how to fix it? It would be much appreciated. ATRT is just the vehicle’s humanoid component fired from the sit detector script.
game.ReplicatedStorage.vehicleATRT.OnClientEvent:Connect(function(ATRT)
Humanoid = ATRT
end)
--// Dependencies
local ContextActionService = game:GetService("ContextActionService")
--// Variables
local DirectionInputs = {Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D}
local DirectionIncrements = {
W = {Begin = Vector3.new(1,0,0), End = Vector3.new(-1,0,0)};
A = {Begin = Vector3.new(1,0,0), End = Vector3.new(-1,0,0)};
S = {Begin = Vector3.new(0,0,-1), End = Vector3.new(0,0,1)};
D = {Begin = Vector3.new(0,0,1), End = Vector3.new(0,0,-1)};
}
--// Functions
local function handleInput(name, state, input)
local keyCode = input.KeyCode
local moveDirection = Humanoid.Parent.Torso.CFrame:VectorToWorldSpace()
Humanoid.Parent.Torso.CFrame:VectorToWorldSpace(moveDirection + DirectionIncrements[keyCode.Name][state.Name])
print(Humanoid.Parent.Torso.CFrame)
end
--// Binds
ContextActionService:BindActionAtPriority("CustomMovement", handleInput, Enum.ContextActionPriority.High.Value, false, unpack(DirectionInputs))