So I have this script
script.Parent.Parent.Giant.Humanoid:MoveTo(game.Workspace.WalkTwo.Position)
The script above stops moving doe...
Here is what it looks like : https://i.gyazo.com/d15d5c46690fa0ce4d258669c2c55c05.mp4
So I have this script
script.Parent.Parent.Giant.Humanoid:MoveTo(game.Workspace.WalkTwo.Position)
The script above stops moving doe...
Here is what it looks like : https://i.gyazo.com/d15d5c46690fa0ce4d258669c2c55c05.mp4
There is a time limit to MoveTo. If it does not reach its destination point it will fire MoveToFinished with false.
You could use this and run the MoveTo function again.
local humanoid = script.Parent.Parent.Giant.Humanoid
local vecList = {
-- list of positions vector3
}
local curPoint = 1 -- holds the current walk to point
humanoid:MoveTo(vecList [curPoint]) -- the first point
humanoid.MoveToFinished:Connect(function(foundEnd)
if foundEnd then
curPoint = curPoint + 1 -- go to next point if found
end
if vecList [curPoint] then -- check we have a vector3 to walk to
humanoid:MoveTo(vecList [curPoint])
else
print('end') -- no more points
end
end)
I hope this helps.
Yes this helps but the script isn't working? I've changed my vecList to local vecList = { game.Workspace.WalkOne } but it doesn't walk to it, and also I got an error, 'Giant is not a valid member of DataModel' ? how do I fix this. So yeah I want to make this cause I'm making a sort of Tower Battles game xD
game.Workspace.WalkOne is an instance not the vector 3. Use the Position which is a vector3
Okay thank you so much!! IT WORKS :D
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
because the NPC gets tired so it stops for a break