You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Perfect PathFinding GUI
- What is the issue? Include screenshots / videos if possible!
Pathfinding works perfect, but sometimes just runs into walls and gets stuck
Here how it goes:
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Didn’t help much
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local plr=game:GetService("Players").LocalPlayer
local char=plr.Character or plr.CharacterAdded:Wait()
local hum=char:WaitForChild("Humanoid")
local root=char:WaitForChild("HumanoidRootPart")
local service=game:GetService("PathfindingService")
local mouse=plr:GetMouse()
local waypointz={}
local function onCharacterAdded(newChar)
char=newChar
hum=char:WaitForChild("Humanoid")
root=char:WaitForChild("HumanoidRootPart")
end
plr.CharacterAdded:Connect(onCharacterAdded)
local function AddWaypoint()
local point=Instance.new("Part", game.Workspace)
point.Name="WP88871"
point.Position=root.Position
point.Anchored=true
point.Transparency=0.35
point.CanCollide=false
point.Size=Vector3.new(1, 1, 1)
point.BrickColor=BrickColor.new("Bright Red")
table.insert(waypointz, point)
end
local function Navigate()
for i=1, #waypointz-1 do
local startp=waypointz[i]
local endp=waypointz[i+1]
local path=service:CreatePath()
path:ComputeAsync(startp.Position, endp.Position)
if path.Status==Enum.PathStatus.Success then
local points=path:GetWaypoints()
for _,v in ipairs(points) do
if v.Action==Enum.PathWaypointAction.Jump then
hum.Jump=true
end
hum:MoveTo(v.Position)
hum.MoveToFinished:Wait()
end
else
print("Failed finding a path. Please rebuild the waypoints.")
return
end
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.