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

<error-type> error that appears when trying to script a mob NPC?

Asked by 2 years ago

Hello!

I am making an NPC that when parented In workspace, It will create a small mob, the problem Is that where Is a Issue when doing a pathfinding script for the other mobs, the Waypoints said: "<error-type> I am currently new to this type of error

Script

local COPER = script.Parent
local PathFinding = game:GetService("PathfindingService")

if COPER.Parent == game.Workspace then
    for i=0, 5 do
        local COPERBOI = game:GetService("ReplicatedStorage")["Coper Boi"]:Clone()
        COPERBOI.Parent = game.Workspace
        COPERBOI.Torso.Position = COPER.Torso.Position
        local Path = PathFinding:CreatePath()
        Path:ComputeAsync(COPERBOI.Torso.Position,COPER.Torso.Position)
        if Path.Status == Enum.PathStatus.Success then
            local Waypoints = Path:GetWaypoints()
            for i,v in pairs(Waypoints) do
                local Waypoint = Instance.new("Part",game.Workspace)
                Waypoint.Position = v.Position
                Waypoint.Transparency = 1
                Waypoint.CanCollide = false
                COPERBOI.Humanoid:MoveTo(Waypoint.Position)
                COPERBOI.Humanoid.MoveToFinished:Wait()
                Waypoint:Destroy()
                wa
            end
        end
    end
end

Answer this question