I have a rig that is intended to go to EndPoint, which is a part in the Workspace, using PathfindingService. I added a PathfindingModifier to the Red Part shown in the video, and set its PassThrough value to false. However, the rig still goes through it. Can anyone explain to me why this happens? Cause I genuinely don't know.
PathfindingService Code:
local rig = script.Parent
local humanoid = rig:WaitForChild("Humanoid")
local pathFindingServ = game:GetService("PathfindingService")
local agentParams = {
AgentRadius = 2,
AgentHeight = 5,
AgentCanJump = true,
AgentJumpHeight = 7,
AgentMaxSlope = 45,
}
local endPoint = workspace:WaitForChild("EndPoint").Position
local startPoint = rig:WaitForChild("HumanoidRootPart").Position
local newPath = pathFindingServ:CreatePath(agentParams)
newPath:ComputeAsync(startPoint, endPoint)
local waypoints = newPath:GetWaypoints()
for i, waypoint in ipairs(waypoints) do
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
** You are now Level 4! **