How To Make A Pathfinding NPC | Roblox Studio

  Рет қаралды 26,104

FrozenTutorials

FrozenTutorials

Күн бұрын

Пікірлер: 64
@fatalstupidanimator1410
@fatalstupidanimator1410 10 ай бұрын
i actually found out how to make the AI to jump, it's actually already coded in! at the "for _, waypoint in pairs(path:GetWaypoints()) do" add this before the "NPC.Humanoid:MoveTo(waypoint.Position)" part if waypoint.Action == Enum.PathWaypointAction.Jump then NPC.Humanoid.Jump = true end edit: heres an explanation: PathWaypoints have a function added to them: Action. It can be Enum.PathWaypointAction.Jump or Walk. If it's jump, that means that the AI needs to jump to complete the next waypoint. So you can add a part that detects if that occurs, you can make the NPC jump. (no the ai cannot do wrap-arounds ;~;)
@odineli7177
@odineli7177 3 ай бұрын
local pfs = game:GetService("PathfindingService") local npc = script.Parent local part = workspace:WaitForChild("Skibussy") local path = pfs:CreatePath() path:ComputeAsync(npc.HumanoidRootPart.Position, part.Position) for _, waypoint in pairs(path:GetWaypoints()) do if waypoint.Action == Enum.PathWaypointAction.Jump then npc.Humanoid.Jump = true end npc.Humanoid:MoveTo(waypoint.Position) npc.Humanoid.MoveToFinished:Wait() end 👍👍
@Gamer28591
@Gamer28591 Жыл бұрын
Dina Tutorials är grymt bra!
@TMK899
@TMK899 Жыл бұрын
Welcome Back King!
@CaseAB
@CaseAB 8 ай бұрын
the script: local pfs = game:GetService("PathfindingService") local NPC = script.Parent local Destination = workspace:WaitForChild("Destination") local path = pfs:CreatePath() path:ComputeAsync(NPC.Humanoid.Position,Destination.Position) for _, waypoint in pairs(path:GetWaypoints()) do NPC.Humanoid:MoveTo(waypoint.Position) NPC.Humanoid.MoveToFinished:Wait() end
@ryannoyoutube
@ryannoyoutube 6 ай бұрын
there is a small error there, in " path:ComputeAsync(NPC.Humanoid.Position,Destination.Position) " is HumanoidRootPart, like this: path:ComputeAsync(NPC.HumanoidRootPart.Position,Destination.Position)
@erickbatista6406
@erickbatista6406 Жыл бұрын
local pfs = game:GetService("PathfindingService") local NPC = script.Parent local part = workspace.Destination local path = pfs:CreatePath() path:ComputerAsync(NPC.HumanoidRootPart.Position.part.Position) for _, waypoint in pairs(path:GetWaypoints()) do NPC.Humanoid:MoveTo(waypoint.Position) NPC.Humanoid.MoveToFinished:Wait() end
@TheRealRoosterXD
@TheRealRoosterXD 3 ай бұрын
The Script: local pfs = game:GetService("PathfindingService") local NPC = script.Parent local part = workspace.Destination local path = pfs:CreatePath() path:ComputeAsync(NPC.HumanoidRootPart.Position,Destination.Position,part.Position) for _, waypoint in pairs(path:GetWaypoints()) do NPC.Humanoid:MoveTo(waypoint.Position) NPC.Humanoid.MoveToFinished:Wait() end
@64126
@64126 Жыл бұрын
thank you for making me suffer from these scripts. i subscribed.
@FrozenTutorialsRoblox
@FrozenTutorialsRoblox Жыл бұрын
You're so welcome!
@Blebo96
@Blebo96 Жыл бұрын
could you please make a tutorial on how to make pathfinding NPC have a walking animation. Thank you
@zaydtruck3496
@zaydtruck3496 Жыл бұрын
make ur animation and because the NPC Wales forever u can simply make the animation play forever
@mazdnic
@mazdnic Жыл бұрын
you can put animation script to the function where pathfinding starts
@Blebo96
@Blebo96 Жыл бұрын
thanks@@mazdnic
@TheOfficialTHStudios
@TheOfficialTHStudios Жыл бұрын
What if i want to do it like the mimic like i want him to walk and get player how can i do that please?? Also if there is a wall how can i make him go left or go right??
@5kopster
@5kopster 3 ай бұрын
change his destination to the player's primary part position
@JanKalousWithInternetAccess
@JanKalousWithInternetAccess Жыл бұрын
Hey frozen does the NPC have to be a rig?
@joshuadavid3975
@joshuadavid3975 Жыл бұрын
No it doesn’t, as long as you rig your own character correctly it will work
@Qbix1234official
@Qbix1234official 7 ай бұрын
Does someone know how to make the AI just stand and do nothing while not seeing the player instead of walking to waypoints? I tried so much but it doesn't work
@GiacomoAruta
@GiacomoAruta 5 ай бұрын
Try to use 2 different bots
@brandonbombplays9304
@brandonbombplays9304 18 күн бұрын
Check for the difference between the NPC's position and the player's to get the distance, and then only run the pathfinding code if it's small enough for the NPC to see you; it'll even keep going towards where it last saw you. Only problem is that it could see through solid objects, but that would just be a ton more ludicrous to code.
@ImProcrastinating0
@ImProcrastinating0 Ай бұрын
I’m just curious, what is the for loop for? I haven’t tested this script out yet but looking at it it doesn’t look like the loop is needed. Can anyone tell me why it’s there?
@КанатСагадиев-и5й
@КанатСагадиев-и5й Ай бұрын
As i understand how computeAsync works, it computes where to "create" waypoints and then we go through waypoints by using for _ loop and move NPC to each waypoint it created.
@zombie_gamer2122
@zombie_gamer2122 6 ай бұрын
It didn't work. Literally nothing works for me. >:(
@ingritE1
@ingritE1 6 ай бұрын
Currently, Models containing a Humanoid instance, including typical player characters, will not be considered for path computation or path blockage, although the agent may still be blocked by those models physically. - Documentation - Roblox Creator Hub
@PixelThetwo-w1h
@PixelThetwo-w1h 4 ай бұрын
Because you did not learn scripting
@ingritE1
@ingritE1 4 ай бұрын
@@PixelThetwo-w1h Yeah I am still learning
@wackywtp
@wackywtp 3 ай бұрын
how do i make it change the script so it follows the player continuously
@jackruffner5653
@jackruffner5653 Жыл бұрын
the animation restarts everytime i reach a waypoint which screws up the animation, please make a tutorial on how to fix
@aqaisback9517
@aqaisback9517 11 ай бұрын
make the animation set to action and make sure it is looped
@zeroforcrazyx4975
@zeroforcrazyx4975 Жыл бұрын
3:45 script
@bigboy_atom
@bigboy_atom Жыл бұрын
Can you fix this error GetWayPoints is not a valid member of Path "Instance"
@FrozenTutorialsRoblox
@FrozenTutorialsRoblox Жыл бұрын
Make sure it says "GetWaypoints" and not "GetWayPoints"
@testbonne.
@testbonne. Жыл бұрын
Hi😊
@FrozenTutorialsRoblox
@FrozenTutorialsRoblox Жыл бұрын
hello
@cloudnthebois
@cloudnthebois 11 ай бұрын
it says humanoidrootpart dosent belong in workspace or something like that
@JFSTD_
@JFSTD_ Жыл бұрын
how do i weld a object to another?
@Lilleelovee
@Lilleelovee Жыл бұрын
Ctrl-mouse right ( or track pad
@cloudnthebois
@cloudnthebois 11 ай бұрын
How to do it if it has multiple parts
@HarryLikesLambos
@HarryLikesLambos Жыл бұрын
Where has the videos been?!
@FrozenTutorialsRoblox
@FrozenTutorialsRoblox Жыл бұрын
Have both had lot with school and also been trying to fix a bug within the Tycoon tutorial.
@MrToastGHG
@MrToastGHG Жыл бұрын
it isnt working for me what could be the problem?
@FrozenTutorialsRoblox
@FrozenTutorialsRoblox Жыл бұрын
Make sure the npc isn't anchored
@MrToastGHG
@MrToastGHG Жыл бұрын
omg i was so dumb now it works tysm@@FrozenTutorialsRoblox
@الخلبوصة
@الخلبوصة 6 ай бұрын
does it really work or are you offending him?
@green-s7f
@green-s7f Ай бұрын
@@الخلبوصة bro wdym💀
@الخلبوصة
@الخلبوصة Ай бұрын
@@green-s7f his tone of the comment makes me feel like hes offending him, and that it didnt really fix the error
@raulpaulogalura5754
@raulpaulogalura5754 8 ай бұрын
my rig dosent even move it just stays there WHY
@stx_1
@stx_1 7 ай бұрын
its deprecated meaning its broken and it wont get fixed
@flynnmeskus2503
@flynnmeskus2503 6 ай бұрын
how do I make it follow the player?
@turkeyhater
@turkeyhater 6 ай бұрын
instead of the npc following the "part" in the script, make it so the Destination is the player, or aka the "LocalPlayer" as you would write it
@woopertrooper_L
@woopertrooper_L Жыл бұрын
Frozen can u pls help me with a single simple script I need help with pls
@Xero_92
@Xero_92 Жыл бұрын
cool
@Kingofkratos
@Kingofkratos Жыл бұрын
How my dropper can drop a egg? pls tell me the script with auto dropper
@ProjectCryo
@ProjectCryo Жыл бұрын
You have to use a meshID
@Котик-й3в
@Котик-й3в 9 ай бұрын
bruh why in every tutorial lm cant create ai bruhhhhh
@leonardo.7609
@leonardo.7609 6 ай бұрын
its not ai
@BrownTroutYTOfficial
@BrownTroutYTOfficial 8 ай бұрын
does not work
@jaykodi4262
@jaykodi4262 5 ай бұрын
can you change it so that it follows a player instead of a part?
@TigerSnipe7
@TigerSnipe7 4 ай бұрын
just change the players name to player or humanoid i aint no professinal coder so idk how
@5kopster
@5kopster 3 ай бұрын
I this line of code: local part = workspace.Destination change workspace.Destination to a player's primary part
@GiacomoAruta
@GiacomoAruta 5 ай бұрын
Ik u wont answer BUT IF YOU DO, sup
@p0gg_man965
@p0gg_man965 8 ай бұрын
local pfs = game:GetService("PathfindingService") local NPC = script.Parent local part = workspace.destination local path = pfs:CreatePath() path:ComputeAsync(NPC.HumanoidRootPart.Position,part.Position) for _, waypoint in pairs(path:GetWaypoints()) do NPC.Humanoid:MoveTo(waypoint.Position) NPC.Humanoid.MoveToFinished:Wait() end
AI Monster Pathfinding -Teddy Horror Game #2
16:46
GnomeCode
Рет қаралды 478 М.
I Spent 24 Hours to beat Roblox's Smartest NPC
9:36
AintNoobie
Рет қаралды 802 М.
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН
БАБУШКА ШАРИТ #shorts
0:16
Паша Осадчий
Рет қаралды 4,1 МЛН
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
"Идеальное" преступление
0:39
Кик Брейнс
Рет қаралды 1,4 МЛН
How To EASILY Make Procedural Animations In Roblox
6:46
Roox4
Рет қаралды 130 М.
How to make an Opening Cutscene in Roblox Studio
9:01
RKGAM3ZS
Рет қаралды 69 М.
Roblox Studio - How to make Sliding Doors
8:43
Stars
Рет қаралды 315
How To MAKE a Pathfinding MONSTER In Roblox Studio!
25:23
Rustysillyband
Рет қаралды 37 М.
How to PATHFIND in Roblox 2024 using Forbidden
6:30
Crit
Рет қаралды 27 М.
Why YOUR Baseplate is BORING| Roblox Studios
15:04
Histoic
Рет қаралды 30 М.
How to Make an ENEMY SPAWNER in Roblox Studio!
5:52
DevMelon
Рет қаралды 8 М.
How to animate walking? | Roblox Animation | Roblox Moon Animator
14:34
How to Make a Story Game [Part 2] in Roblox Studio
13:32
Noob Scripts
Рет қаралды 2,3 М.
How To Make A Tycoon , Collectors | Part 2
15:13
FrozenTutorials
Рет қаралды 6 М.
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН