You can write your topic however you want, but you need to answer these questions:
-
So the first pathfinding works and moving of the humanoid, when i try to stop it and move it in the other two below it the humanoid completely stops moving and does not go anywere basically im scripting it to were a humanoid chases the player if it touches them it runs past them, if they dont get touched for a ceirtain amount of time it will run away
-
it chases after them fine but when i stop that loop and try to move the humanoid again in any other direction it stops moving completely
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
spawn(function()
while caught == false do
task.wait()
local path = ps:CreatePath({
AgentRadius = 4,
AgentHeight = 5,
AgentCanJump = true
})
path:ComputeAsync(mons2:WaitForChild("ScaryDude"):WaitForChild("HumanoidRootPart").Position,hr.Position)
local wp = path:GetWaypoints()
hum2:MoveTo(wp[2].Position)
end
end)
spawn(function()
while caught == false do
wait()
local mag = (hr.Position - hr2.Position).Magnitude
if mag<= 2.5 then
caught = true
local controls = require(plyr.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
--controls:Disable()
hum2.WalkSpeed = 20
local ps2 = game:GetService("PathfindingService")
local path = ps2:CreatePath({
AgentRadius = 4,
AgentHeight = 5,
AgentCanJump = true,
["WaypointSpacing"] = math.huge
})
path:ComputeAsync(hr2.Position,part.Position)
local wp = path:GetWaypoints()
for i=1, #wp do
wait()
hum2:MoveTo(wp[i].Position)
hum2.MoveToFinished:Wait()
print(wp[i].Position)
end
task.wait(2)
--plyr:Kick("INVESTIGATION FAILED")
end
end
end)
task.wait(5)
caught = true
wait()
hum2:MoveTo(Vector3.new(5,5,5))
wait()
hum2.WalkSpeed = 30
task.wait(5)
mons2:Destroy()
inpersuit = false
caught = false
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.