Advanced Roblox Scripting Tutorial #21 - Pathfinding (Beginner to Pro 2019)

preview_player
Показать описание
Advanced Roblox Scripting Tutorial #21 - Pathfinding (Beginner to Pro 2019)

Hey guys! Welcome back to a brand new roblox scripting tutorial. In today's video I am going to be teaching you about pathfinding / pathfinding service. This is an insanely fun but important topic and I'm so excited to show you guys! If you have any questions like always leave them in the comments. Enjoy :)



-- Join my Discord Server to learn and meet other developers!--

Link to Beginner's Tutorial Series:

--What is this series about and who is it for?

So this series is meant for people who really want to learn exactly how to script, if that is you then I promise by the time you watch this whole series you will know exactly how to script on roblox. Anyways be sure to subscribe to see whenever I release a new tutorial and I will see you guys in the next one. Peace!
Рекомендации по теме
Комментарии
Автор

Hey @TheDevKing, I really appreciate your scripting tutorials from the past (lol). Before I watched your scripting tutorial for pathfinding, I would be confused because I was quite a new scripter back then. After watching your video, understanding it, and practicing it, I can now make a randomizer for this specific service! Thanks a lot! Hope you make more tutorials like this!

shishiirpriyadarshi
Автор

Hello, everyone! if you are too lazy to type the script, here is the fully written sc:
local PathFindingService =
local human =
local torso =

local path =
path:ComputeAsync(torso.Position,
local Waypoints = path:GetWaypoints()


end)

for i, Waypoint in pairs(Waypoints) do
local part = Instance.new("Part", workspace)
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Position = Waypoint.Position + Vector3.new(0, 2, 0)
part.Anchored = true
part.CanCollide = false

if Waypoint.Action == Enum.PathWaypointAction.Jump then
human.Jump = true
end


human.MoveToFinished:Wait()
end


orange
Автор

7:20 "It's gonna get stuck on the wall - cuz it has *no brain* "

Poor NPC ;c

MarkoBrainz
Автор

2:25 We're going to use r15 cause it's pretty simple. *deletes r15 model*

splishymancity
Автор

the reason it is "lagging" is because of the wait(2). towards the end the paths were shorter because the npc just had to jump over stuff, so it was taking less than 2 seconds to get to the next waypoint and it had to stop and wait for the 2 seconds to finish.
Instead you should make it wait until the movetofinished is called

specificocean
Автор

For all of you confused, 1) You have to type local torso = for r15 2) if your rig is still not moving, make sure the humanoid root part isn't anchored

SnortingPig
Автор

If you want to have the path constantly update and overcome newly placed obstacles which weren't calculated by the previous path, recalculate the path in a while loop until the character reaches the finish position!

FoodCats
Автор

Perfect i needed this for fire flies thank you so much perfect timing coming in clutch every time

chickenoodle
Автор

at the very end, you can use task.wait(2s) and then part:Destroy(), so that way it won't make too much parts on ur workspace

ItsHunderr
Автор

i love how when he doesnt know what to say about something he just acts like he never talked about it and just says "you know what i mean anyways"

IDcLuc
Автор

If you want the npc to go to one point then to another all you have to do is after finishing the script go down 1 and write wait(1) then copy and paste the first part under the wait(1) and change ending part to the name of the other part

themanpro
Автор

If you use R15, this won't work exactly the same, use an R6 model because it has "Torso" and not "Upper" or "Lower Torso." I haven't gotten the r15 to work but I assume you can target both upper and lower torso at the same time to be able to move it. Or perhaps it's humanoidrootpart, but I haven't figured it out.

bowling
Автор

Thank you! I've been learning lua because I wanted to step up from scratch and this is perfect for my monster in my horror game!

BeerusWhenNoWhis
Автор

If you are doing it with an R15 character, replace the torso with the "HumanoidRootPart"

vkrpn
Автор

4:05 Humanoid isn't a part and has no position
12:10 Every waypoint has actions (Walking or jumping)
15:50 Blocked event. In case the map changes or the AI gets stuck.
17:35 May need to use raycasting for pathfinding aswell

paifu.
Автор

when you do this on a r15 rig, make sure that you have the HumanoidRootPart unanchored otherwise the character won't move.

kennethha
Автор

Thanks for the amazing tutorial! I’m using it for a game similar to Work at a Pizza Place. I needed pathfinding so I could spawn NPCs at random locations. They needed to walk to the cashier to take their orders lol.

Nathanator
Автор

Fun thing to do: Make lots of them with the pathfinding script. Put the endingpart inside the region3 from the tutorial a bit back. Where when found inside they die :)

fxnlxn
Автор

I saw some people mention this, but you don't want to use torso when referring to the roblox character's torso. This will cause a discrepancy between R6 and R15 avatars because R15 uses UpperTorso and LowerTorso.
Instead, use HumanoidRootPart. It doesn't matter if the character is R15, R6, RTHRO, even R34 (that one isn't real also don't look it up), HumanoidRootPart will always be in the same place.
What is HumanoidRootPart? HumanoidRootPart is an invisible part in the roblox avatar located where the torso would be. It was made to fix the conflict between R15 and R6 avatars. It is also the primary part of the player model, so if you want to move the player, move the HumanoidRootPart.

TL;DR: Don't use Player.Torso, because there is no "Torso" part in R15 characters. Instead use "HumanoidRootPart". It's located in the same place as the torso.

mizellland
Автор

I just turned my local stop sign into a humanoid and its chasing me, help me

top-nerdygamer