Getwaypoints is not a valid member of Path "Instance"

Hello, recently I’ve been following a youtubers tutorial and trying to make a game.
I was creating the pathfinding script when I got an error which my head cannot fix.

image

The script:


local Maxwell = workspace:WaitForChild("Maxwell")
local HRP = Maxwell:WaitForChild("HumanoidRootPart")
local Humanoid = Maxwell:WaitForChild("Humanoider")
local locations = script.Parent
local randomLocations = locations:WaitForChild("RandomLocations")

local path = pathFindingService:CreatePath()

local randomLocation = randomLocations:FindFirstChild(math.random(1,3))
path:ComputeAsync(HRP.Position, randomLocation.Position)
local waypoints = path:Getwaypoints()
Humanoid:MoveTo(randomLocation.Position)

Does anyone know why and how to fix this?

2 Likes

i think its GetWaypoints and not Getwaypoints

local Maxwell = workspace:WaitForChild("Maxwell")
local HRP = Maxwell:WaitForChild("HumanoidRootPart")
local Humanoid = Maxwell:WaitForChild("Humanoider")
local locations = script.Parent
local randomLocations = locations:WaitForChild("RandomLocations")

local path = pathFindingService:CreatePath()

local randomLocation = randomLocations:FindFirstChild(math.random(1,3))
path:ComputeAsync(HRP.Position, randomLocation.Position)
local waypoints = path:GetWaypoints() -- this line
Humanoid:MoveTo(randomLocation.Position)