Hello, I’m trying to make a model move around to different parts in a house, i’ve named them nodes.
Unfortunately the script Im using does not give an error, and the model is not anchored.
Inside the NPC:
the script:
local Humanoid = Character.Humanoid
for i,v in pairs(game.Workspace.Nodes:GetChildren()) do
Humanoid:MoveTo(v.Position, v)
Humanoid.MoveToFinished:Wait(1)
end
function PickRandom(Hum: Humanoid?)
local children = Nodes:GetChildren() -- returns a table of Instances
local new = children[math.random(1, #children)] -- Picks a Random instance
if new then -- if Instance
Hum:MoveTo(new.Position) -- MoveTo Instance
Hum.MoveToFinished:Wait() -- Yields code for roughly 8 Seconds
end
end
PickRandom(Character.Humanoid)