I am trying to make a script that makes a block follow a certain path that I make the one I used doesn't work could anyone help me with this?
Script:
local pathParts = game.Workspace.Path
local start = game.Workspace.Start
local finish = game.Workspace.Finish
local PathfindingService = game:GetService("PathfindingService")
local path = PathfindingService:CreatePath()
path:ComputeAsync(start.Position, finish.Position)
-- Get the path waypoints
local waypoints = path:GetWaypoints()
pathParts:ClearAllChildren()
-- Loop through waypoints
for _, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Position = waypoint.Position
part.Anchored = true
part.CanCollide = false
part.Parent = pathParts
end
