I am trying to find out how to make/draw a line between a start and end point of a character path. Similar to what they do in the Pet Simulator game. When you click on the coins, the Pet uses a WalkToPoint (or something similar), and moves towards the coin. I know how to do that, but in that game, there is a cool line that is drawn to show the path. Also there is a circle underneath the pet (current Position) and one underneath the coin (target Position).
Does anyone know how to code to draw that line (dots in this case)? Or can you point me to some tutorial or documentation, please?
I have looked a lot already, learned a little about Pathfinding, NavMesh, but I couldn't find much, if anything, about drawing the path.
I found a way to do it with creating Parts, but I would rather have it displaying as a dotted line like the Pet Simulator game.
Thanks!
-- Make variables for Roblox services
local PathfindingService = game:GetService("PathfindingService")
-- Make variables for the start and end of the path
local start = Vector3.new(0, 1, 0)
local finish = Vector3.new(25, 1, -60)
-- Find the path and get the waypoints
local path = PathfindingService:FindPathAsync(start, finish)
local waypoints = path:GetWaypoints()
-- Loop through all of the waypoints in the path
for waypointIndex, waypoint in pairs(waypoints) do
-- Create a part for each waypoint and position the part
-- at the waypoint's position.
local part = Instance.new("Part")
part.Size = Vector3.new(1, 1, 1)
part.Position = waypoint.Position
part.CanCollide = false
part.Anchored = true
part.Parent = game.Workspace
end
