Alternative to humanoid:MoveTo

As you all probably know, Humanoid:MoveTo() is a way to smoothly move your character to a specified position. The problem is that it doesn’t work when the humanoids walkspeed is set to 0. Is there any way to move the player smoothly while their walkspeed is 0?

2 Likes

What’s your use case? Why not just increase their WalkSpeed while you move them? The best solution I can really think of is to use CFraming but that might not properly animate them and might not appear correctly.

1 Like

I’m trying to make a cutscene where the character walks to a certain area.

You don’t need to set speed to 0 to do that? If you are doing to to prevent the player from moving then just disable the controls.

There isn’t really a need for an alternative, Humanoid:MoveTo() works well.

The problem is it doesn’t work when the player is speeded 0

How would I go about doing that?

Yeah I saw that, but why would you set the speed to 0?

Edit: nvm i see why.

you can disable the controls with this

local LocalPlayer = game:GetService("Players").LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()

Controls:Disable()
1 Like

Would controls:Enable() reenable the controls?

There should be a way with the built in control module to disable player movement. One way would be to send something to the client with a remote to tell it to disable its movement, then, you’d require the client module and disable movement that way. (@Nube762 posted exactly what you’d want to use).

Also, personally I would use LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule") in case they haven’t loaded yet so you won’t get any unexpected errors.

Then, you can just set their HumanoidRootPart to have server network ownership: HumanoidRootPart:SetNetworkOwner(nil). This would stop their client from controlling their character’s physics at all (they can still control their humanoid hence why the above is necessary)

Once you’re done with the cutscene, you can reenable controls, and, you can tell the client to return control and change the network ownership back with HumanoidRootPart:SetNetworkOwner(player).

Pathfinding service. To create space between them I personally use this algorithm where you have a count and you mod that to a certain power. Whether that be 2, 5, 10, 20 it has to follow that escalation order.

local count = 0
while wait() do
  if count % 5 then
    count += 1
    --Code for NPC to move
  else
    --Code for NPC to slow down
  end
end