Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local eggspot = workspace.Map.Maze.Generated.SectorPiece.Objectives.Door.Door.Part1
- print(eggspot.CFrame)
- local makeend = Instance.new("Part",workspace)
- makeend.Anchored = true
- makeend.CanCollide = false
- makeend.CFrame = eggspot.CFrame
- makeend.Size = Vector3.new(1,1,1)
- makeend.Name = "mazeend"
- print("1")
- wait(.5)
- print("2")
- -- Local values to call later
- local player = game:GetService("Players").LocalPlayer
- local human = player.Character.Humanoid
- local playerpos = player.Character.Head.Position
- local ending = workspace.mazeend.Position
- print("before path")
- local path = game:GetService("PathfindingService"):FindPathAsync(playerpos,ending)
- local points = path:GetWaypoints()
- print("locals")
- --SHOWS WHERE POINTS ARE
- for i,v in pairs(points) do
- local z = Instance.new("Part",workspace)
- z.Anchored = true
- z.CanCollide = false
- z.CFrame = CFrame.new(v.Position)
- z.Size = Vector3.new(1,1,1)
- z.Name = "PointPath"
- end
- print("points")
- -- WALKS TO POINTS
- if path.Status == Enum.PathStatus.Success then
- print("walking")
- for i,v in pairs(points) do
- human:MoveTo(v.Position)
- human.MoveToFinished:wait()
- if v.Action == Enum.PathWaypointAction.Jump then
- human.Jump = true
- end
- end
- end
- print("ending")
- --Removes point blocks
- --[[
- wait(.1)
- for i,v in pairs(game.Workspace:GetChildren()) do
- if v.Name == "PointPath" then
- v:Destroy()
- wait()
- end
- game:GetService("Workspace").mazeend:Destroy()
- end
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement