How to do an automatic character movement?

How to do an automatic character movement like, your character automatically runs/walks forward without you controlling it with the joystick or “W”. You will be able to control its movements using your camera. It’s like for example, you turn your camera 90 degrees, the movement forward of the character changes to where the camera is looking at. (it doesnt detect Y axis though, only X and Z)

Then after that, you will be able to control your character again normally.

local distance = 10?? is that it?

try this

game.Players.PlayerAdded:Connect(function(plr)
    if plr.Character then
          plr.Character.Humanoid:MoveTo(workspace.Part)
          plr.Character.Humanoid.MoveToFinished:Wait()
     end
end)

Try this. This will make your character autowalk when you press Z

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Humanoid:Humanoid = Character:WaitForChild("Humanoid")

local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local AutoWalking = false

UIS.InputBegan:Connect(function(Input, GameEvent)
	if GameEvent then
		return
	end
	if Input.KeyCode == Enum.KeyCode.Z then
		AutoWalking = not AutoWalking
	end
end)

RunService.RenderStepped:Connect(function()
	if AutoWalking then
		Humanoid:Move(Vector3.new(0,0,-1), true)
	end
end)
2 Likes