So basically I have script located inside an NPC's head which is supposed to make him walk to the player (1 player server btw). However, he instead goes straight for the wall. Could somebody help me fix this problem please?
Script:
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) while true do wait(.1) script.Parent.Parent.Humanoid.WalkToPoint = Vector3.new(char.HumanoidRootPart.Position) end end) end)
Using WalkToPoint makes the Humanoid move from its current Vector3 position to the Vector3 position provided by WalkToPoint. This causes the Humanoid to run in a straight line, regardless of what is in its way.
There is pathfinding in Roblox, however it requires more scripting. https://developer.roblox.com/articles/Pathfinding Here is a link that will hopefully teach you more about it. I feel that it is explained well enough for me to not go into detail. Best of luck!