Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i use pathfinding service in a zombie i made?

Asked by 8 years ago
Edited by BlueTaslem 8 years ago

I want to make a zombie that moves towards a player. I know how to get pathfind service and make points from the youtube tutorial, but instead of showing people how to insert that script into a model with humanoid and make it move, he assumes everyone already knows how to script it, skips to a game showcase, and ends the video. How does he expect the players to use the pathfind service, if he just shows us how to make a bunch of dots? can someone fill in the blanks for me please? this is the script he gave:

while true do

local StartPos = script.Parent.Torso

local EndPos = game.Workspace.th

path = game:GetService("PathfindingService"):ComputeRawPathAsync(StartPos.Position, EndPos.Position, 200)

local points = path:GetPointCoordinates()

game.Workspace.Points:ClearAllChildren()

for p = 1, #points do

local part = Instance.new("Part")
part.Size = Vector3.new(1,1,1)
part.Position = points[p]
part.CanCollide = false
part.Anchored = true
part.BrickColor = BrickColor.Black()
part.Parent = game.Workspace.Points
end

wait(.1)





end

I would like for the zombie to follow the closest player. this next part isn't part of the original question so if you just answer with how to make the humanoid move along the path I will accept the answer, but once the zombie reaches the player, I want it to continue to hit and damage the player until the zombie or player is dead. if the player dies first, I want the zombie to aquire a new target. I realize how complicated this is, which is why I will accept any answer that shows me how to make the zombie move along the generated path towards a player. Thank you for your time :)

0
Edited to fix code formatting BlueTaslem 18071 — 8y

Answer this question