Hi there! I’ve been trying to make an NPC walk to a certain position in a viewport frame. I’ve tried using the :MoveTo() function to achieve this, but nothing happens. I understand the position can be incrementally changed to move the NPC, but I want to move the NPC using Roblox physics so animations play properly.
Here’s a snapshot of the hierarchy for the viewport frame:
The ActiveToggler script present is meant to enable the MoveElizabeth script once the viewport becomes visible. This works fine and I can confirm it’s not the issue. The issue is in the movement itself.
How can I achieve movement using :MoveTo(), or some other physics-based movement function?
You are running the Move-To code in a server script (white script)? If so, server scripts do NOT run on the client. It will only run in ServerScriptService & Workspace (there indeed may be a few more places it can run in, but those are the most common.)
I’ve come up with a solution. Instead of using :MoveTo(), you need to tween the NPC to the desired position. If you want a walking animation to play while this is happening (like I do), you can play the walking animation for the duration of the tween.
Any other method of moving the NPC also works, as long as it doesn’t depend on physics. This means any movement caused by velocity or gravity will not get simulated in a viewport frame. Only changing the position property actually moves an object in a viewport frame. It seems this is just a limitation of them.