when i use this script the player does go foward without holding w but he isnt able to move left and right while the script is running i want the player to be able to move left and right while the script is moving him foward
local char:Model = script.Parent
local starterPlayer = game:GetService("StarterPlayer")
local runService = game:GetService("RunService")
local hum:Humanoid = char:FindFirstChildWhichIsA("Humanoid")
--Set Controls
local computerMovement = Enum.DevComputerMovementMode.Scriptable
local devTouchMovementMode = Enum.DevTouchMovementMode.Scriptable
--System
runService.RenderStepped:Connect(function()
local direction = Vector3.new(0,0,-1)
hum:Move(direction,true)
end)
You could basically just detect movement inputs and apply them to the direction you are forcing. That’s one method, but it could get more complex because you’d have to support keyboard, gamepad and mobile (mobile might act like gamepad though, I’m not sure).
You could also try to detect what the default movement script set the move direction to for handling the input and overwrite it. You would likely need to account for the camera however to ensure the data you are getting is accurate.
You’re setting the controller to scriptable and constantly moving the player forward every frame stepped.
If you want to actually have a bit of functionality, you need to script movement keys using UIS or CAS and either making a controller yourself or just continue using the move function for left and right, but that’s assuming your camera is stationary and doesn’t rotate, and in which case you simply just add your relative camera values to your equation.