Please help with my pathfinding script, I have an error no one else has for some reason

I cant figure out the error on my script. I am getting an error saying “Unable to cast Instance to Vector3” on line 13. I have looked on the devforum for a long time, and no luck.

local pathService = game:GetService("PathfindingService")
local startPoint = script.Parent.PrimaryPart
local humanoid = script.Parent.Humanoid
local endPoint = workspace.EnemyGoal.Value

function computePath(startPoint:Vector3, endPoint)
	local Path:Path
	local retriesLeft = 20
	local retryInterval = 1
	
	for i = retriesLeft, 1, -1 do
		Path = pathService:CreatePath()
		Path:ComputeAsync(startPoint, endPoint)
	
		if Path.Status == Enum.PathStatus.Success then
			return Path
		else
			warn("Path failed, retrying...")
		end
	end
error("path failed :sad:")

end

local function walkHumanoid(humanoid:Humanoid, startPoint:Vector3, endPoint:Vector3)
	local Path = computePath(startPoint, endPoint)
	
	local waypoints = Path:GetWaypoints()
	local CurrentWaypointIndex = 2
	
	for _, point:PathWaypoint in ipairs(waypoints) do
		local Part = Instance.new("Part")
		Part.Anchored = true
		Part.CanCollide = false
		Part.Material = Enum.Material.Neon
		Part.Color = Color3.fromRGB(255,255,255)
		Part.Position = point.Position
		Part.Parent = workspace
		Part.Size = Vector3.new(1,1,1)
	end
	
end
computePath(startPoint, endPoint)
walkHumanoid()

the EnemyGoal is a ObjValue or a Vector3Value?

It’s a Vector3. I have to add characters to post this so yeah

alr i see the problem

local startPoint = script.Parent.PrimaryPart -- Position not Specified
computePath(startPoint, endPoint) -- function(Obj,Vector3)
--//
computePath(startPoint.Position, endPoint) -- function(Vector3,Vector3)

Alr, ill try it real quick. more characters…

found the solution. ill close the topic asap