I have a function that is supposed to move an NPC model that is R15, to a specific position of a part but it isn’t working out.
The function is part of a LocalScript in a TextButton in StarterGUI. Here is the relevant code, it’s pretty short and straight-forward:
local NPC = game.Workspace:WaitForChild("NPC"):FindFirstChild("Humanoid")
local destination= game.Workspace:WaitForChild("destination")
function onClick()
--rest of code, not necessary to know--
NPC:MoveTo(destination.Position)
textButton.MouseButton1Click:Connect(onClick)
Nothing happens with the NPC, it becomes stiff and doesn’t move, as if it’s inanimate and anchored. No errors output on my console either. However, the NPC has an Animate script inside of it for R15 and the NPC model is not anchored.
What am I doing wrong?
Also, as MoveTo() users would know, if I do not reference the Humanoid, the script works but in an unintended manner. The NPC model directly teleports from start to finish. I want it to move from start to finish of course (walk, swim, jump etc.).
If nothing is wrong, it’s probably my Animate script, does anyone have a good Animate script for R15 that works?