How can I make a pathfinding beam?

So I have made a little arrow thing that points you to the place you’re supposed to go in the game, shown in the screenshot.

I want to make this beam curve around terrain and parts using PathfindingService or something similar, to make the beam follow a spline-path to the location. Anyone know how I can put multiple points on a beam?

(I’ve looked on the forum, and all I can find about pathfinding is for NPCs, and all I can find about beams is straight lines or single/double curves, so I don’t know where to look)

That’d be really neat, but unfortunately as far as I’m aware that isn’t possible using the Roblox beam object. Probably would require a bit of math to do it otherwise, definitely not the guy to tell you how unfortunately :joy:

1 Like

Use PathfindingService to create a path. This will give you a table of waypoints. You could attach beams in between the waypoints.


So use multiple beam clones in between each point?


Yes probably. Thats the only way I can think of. :thinking:

local PathfindingService = game:GetService("PathfindingService")

local endpoint = workspace.endpoint
local startpoint = workspace.startpoint

local path = PathfindingService:CreatePath()

path:ComputeAsync(startpoint.Position, endpoint.Position)

local waypoints = path:GetWaypoints()

local Folder ="Folder")
Folder.Name = "Waypoints"
Folder.Parent = workspace

for i, v in ipairs(waypoints) do
	local Part ="Part")
	Part.Position = v.Position
	Part.Anchored = true
	Part.Size =, 1, 1)
	Part.Parent = Folder
	if (i > 1) then
		local lastWaypoint = waypoints[i - 1]
		local dist = (v.Position - lastWaypoint.Position).Magnitude
		local Part2 ="Part")
		Part2.Anchored = true
		Part2.BrickColor = BrickColor.Black()
		Part2.Size =, .5, dist)
		Part2.CFrame =, v.Position) *, 0, dist / -2)
		Part2.Parent = Folder
1 Like

Thanks for the code, I was looking for beams and not parts, but the pathfinding loop was exactly what I was looking for.