So I have a script which when a player clicks a button, a clone of an npc comes forward to ask the person what he wants. This thing doesn't seem to work for me. Any help? Here is my script:
local de = 1
function onTouch(plr)
if de == 1 then
de = 2
print("recieved")
local char = game.Workspace.NPC:Clone()
local torso = char:FindFirstChild("HumanoidRootPart") -- The humanoid root part of the cahracter
local pos = (torso.CFrame:pointToWorldSpace(Vector3.new(0, 0, 10))) -- A position from the world space, 5 studs to the left of the humanoid root part.
local hum = char:WaitForChild("Humanoid") -- Identifies the humanoid of the player.
hum.WalkToPoint = pos -- Changes the walking point of the humanoid to walk towards that position.
end
end
script.Parent.ClickDetector.MouseClick:Connect(onTouch)

4 comments
use MoveTo() instead of WalkToPoint
MoveTo() on a Humanoid causes it to walk to a given Vector3, MoveTo() on a character causes the character to teleport to the given Vector3
more specifically, :MoveTo() called on a model moves the model to the given Vector3
MoveTo() on a model tends to be frowned upon, if you were to "teleport" a model then you should be using SetPrimaryPartCFrame