Hi, I’m creating a NPC , and I would like to make it to wander around. I’m trying to use this script but nothing happens, can someone helps me ?
local Model = script.Parent
local Humanoid = Model.Humanoid
local Torso = Model.Torso
local WalkAnim = Humanoid:LoadAnimation(Humanoid.WalkAnim)
while true do
wait(math.random(1,6))
WalkAnim:Play()
Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-16, 16), 0, math.random(-16, 16)))
WalkAnim:Stop()
end
1 Like
do you see any error messages on the console?
no anything , just doesn’t run
Are you sure the NPC isn’t anchored? Try anchoring the model and after that unanchoring it again. Also, use task.wait() instead of just wait(). You may also want to wait for the Humanoid to actually finish walking so you could add “Humanoid.MoveToFinished:Wait()” under the Humanoid:Move line
Nothing to do, maybe is it cause I’m using a model rigged on blender ? but I don’t think so, cause when I use a dummy it still doesn’t work
It’s a server script right? And not a local script. Did you set the PrimaryPart correctly? Humanoids only function if there is a PrimaryPart and I’m not entirely sure but I believe they also need a head. (At least for nametags and stuff but I don’t know about other stuff)/