Humanoid:WalkTo() is "stuttering"

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want my humanoid to walk seamlessly to each destination (in this case, spots on a game board; I’m making my own version of Monopoly).

  2. What is the issue? The humanoid seems to pause after it reaches each space.

The examples of “intended behavior” and “actual behavior” are virtually identical:

  • The walk itself is fired from a BindableEvent.
  • The code runs on the server.
  • The destination blocks are models with PrimaryPart set to the specific part the Humanoid should approach.
  • Right now, it’s set up so that when the Humanoid reaches its destination, it simply fires the event again and continues walking.

Here is the code I’m using in the “intended behavior” example, which doesn’t “stutter”:

local Event = game:GetService("ReplicatedStorage").Walk
local Pos = 0

task.wait(10) -- to give me time to watch from the server side

Event.Event:Connect(function()
	local Humanoid = game.Workspace.Noob.Humanoid -- test subject
	local Board = game.Workspace.Board1
	Pos += 1
	Humanoid:MoveTo(Board:FindFirstChild(tostring(Pos)).PrimaryPart.Position)

	Humanoid.MoveToFinished:Once(function()
    	Event:Fire()
	end)
end)

Event:Fire()

Here is all the code I’m using in the “actual behavior” example, which does “stutter” (there was originally more but I’ve remarked all but this and modified it too to more closely match the “intended behavior” example):

local Pos = 0

be.MovePlayer.Event:Connect(function(main,remaining) -- "be" = game:GetService("ReplicatedStorage").BindableEvents
	local Humanoid = game.Workspace.average_wolfie.Humanoid
	-- It doesn't matter which Humanoid is walking so I'm just testing mine here.
	Pos += 1
	local Board = game.Workspace.Board1
	Humanoid:MoveTo(Board[tostring(Pos)].PrimaryPart.Position)
	
	Humanoid.MoveToFinished:Once(function()
		be.MovePlayer:Fire(main,remaining)
	end)
end)

re.MovePlayer.OnServerEvent:Connect(function(player) -- "re" = game:GetService("ReplicatedStorage").RemoteEvents
	be.MovePlayer:Fire(mm.FetchGame(player.Host.Value))
end)
  1. What solutions have you tried so far? I thought it had something to do with me using FindFirstChild() for a few of the lines, but changing this had no effect. I have much more code that runs but I’ve bared it down to what I believe is the absolute minimum I need to walk the player in this scenario, and it still happens. I also recall attempting to use Humanoid:WalkTo() on a LocalScript and it didn’t “stutter”.
1 Like

Are you running this on the server? I’m assuming so. Please beware that there will always some delay from when a remote is fired and the code connected to it executes, meaning there’s always going to be “stutters”.

The client will always be much, much faster than the server with any sort of processing. This is why it’s seamless when you do it on the client.

I’d suggest changing your code directly to make just 1 MoveTo call so it’s seamless.

Both of these are running on the server. I even just added a remote event to my “intended behavior” test and the Humanoid still did not stop at every single block before continuing to walk.

I just moved the code into a LocalScript and it’s working as intended now.

I just wanted to mention even though you have your own solution that this is a network ownership issue.
https://create.roblox.com/docs/physics/network-ownership

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.