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

why wont this work?

Asked by
Benqazx 108
9 years ago
01local p=game:GetService("PathfindingService")
02p.EmptyCutoff=0
03spawn(function()
04    local torso,humanoid = script.Parent:WaitForChild("Torso"),script.Parent:WaitForChild("Humanoid")
05    torso.Touched:connect(function()
06        wait(math.random())
07        humanoid.Jump = true
08    end)
09    local walk;
10    walk=function()
11        local target = script.Parent.Targe.Value.Torso
12        local path=p:ComputeSmoothPathAsync(torso.Position,target.Position,500)
13        if path.Status.Name == "Success" then
14            local points = path:GetPointCoordinates()
15            for i,point in pairs (points)do
View all 48 lines...

it is a pathfind script. i use a different model to make my own but this does not work. in the output this error pops up. 00:30:36.619 - Unable to cast Instance to Vector3 00:30:36.619 - Script 'Workspace.Police.Script', Line 25 - local walk 00:30:36.619 - Script 'Workspace.Police.Script', Line 47 00:30:36.620 - Stack End can someone help me please

1 answer

Log in to vote
2
Answered by 9 years ago

This isn't the best code in the world, but ignoring that, I think the main issue is these lines (17-20):

1if part then
2    point = p
3    points[i] = p
4end

p is the PathfindingService (defined in line 1). P, uppercase, is what you want to replace those lowercase ones with:

1if part then
2    point = P
3    points[i] = P
4end
Ad

Answer this question