luarobloxlogic-error

I dont understand why i Humanoid:MoveTo isnt working like i want it to


trying to write a lua script where an npc walks to the player, code that i have struggled in troubleshooting is basically as follows:

enemy = script.parent
torso = player:FindFirstChild("UpperTorso")
position = torso.Position
enemy.humanoid:MoveTo(position)

my code for getting the player works so thats not something im worried about

i tried doing enemy.Humanoid:MoveTo(Vector3.new(999,0,999)) and the roblox model still does not move, this model is spawned in using another script, and no errors appear, ive even tried using print statements to debug, but its like everything works except for the fact that it isnt moving. nothing is anchored or anything either.


Solution

  • What is most likely is that part of the enemy character is anchored, (probably the HumanoidRootPart) and making sure everything in the enemy is unanchored, and it shoould work.