Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Dummy need to be unanchor all parts.
- local humanoid = script.Parent.Humanoid
- local hrp = script.Parent.HumanoidRootPart
- local pathfindingService = game:GetService("PathfindingService")
- wait(20)
- local function showPath(path)
- local waypoints = path:GetWaypoints()
- for _, waypoint in ipairs(waypoints) do
- local part = Instance.new("Part", game.Workspace)
- part.Shape = Enum.PartType.Ball
- part.Material = Enum.Material.Neon
- part.Anchored = true
- part.CanCollide = false
- part.Size = Vector3.new(0.6, 0.6, 0.6)
- part.Position = waypoint.Position
- game:GetService("Debris"):AddItem(part, 5) -- Deleted Parts in 5 seconds
- end
- end
- local function createPath(target)
- local agentParams = {
- AgentHeight = 2.5,
- AgentRadius = 2,
- AgentCanJump = true
- }
- local path = pathfindingService:CreatePath(agentParams)
- path:ComputeAsync(hrp.Position, target.Position)
- if path.Status == Enum.PathStatus.Success then
- local waypoints = path:GetWaypoints()
- return path, waypoints
- end
- end
- local function main()
- local target = game.Workspace.EndPart
- if target then
- local path, waypoints = createPath(target)
- if path and waypoints then
- local showThePath = showPath(path)
- for _, waypoint in ipairs(waypoints) do
- if waypoint.Action == Enum.PathWaypointAction.Jump then
- humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
- end
- humanoid:MoveTo(waypoint.Position)
- humanoid.MoveToFinished:Wait(2)
- end
- end
- end
- end
- while wait() do main() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement