How To MAKE a Pathfinding MONSTER In Roblox Studio!

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ม.ค. 2025

ความคิดเห็น •

  • @uz969
    @uz969 7 หลายเดือนก่อน +3

    thank you rustysillyband, this works really well and i couldn't have done this without your video

  • @AVG.J7
    @AVG.J7 6 วันที่ผ่านมา +1

    can you help me my code says: HumanoidRootPart is not a valid member of MeshPart "Workspace.SCP-427-1.SCP427_1_Model"

  • @everytime-v8g
    @everytime-v8g 9 หลายเดือนก่อน +4

    W VID MPAN KEEP MAKING THOSE VIDS

  • @FungiGtagVR
    @FungiGtagVR 4 หลายเดือนก่อน +5

    OMG TYSM! I've been searching for an actual working pathfinding monster for months and i finally found yours! This really helped!

    • @rustysillyband
      @rustysillyband  4 หลายเดือนก่อน

      Have fun!

    • @BananaBunchGTAG
      @BananaBunchGTAG 4 หลายเดือนก่อน

      @@rustysillybandcan you help me please in my studio output it says: Workspace.rig.PathFindingScript:87: invalid argument #2 to ‘random’ (interval is empty)

  • @Toota_c
    @Toota_c 7 หลายเดือนก่อน +12

    Finally a video not 4 years old 🙏😭
    The script works well but my attack animation does not stop it continues without switching to the walk animation
    I would like to know how to fix it even tho it's not a big deal I can just do a jumpsare scene instead

    • @KristianIsVeryVeryTall
      @KristianIsVeryVeryTall หลายเดือนก่อน

      real

    • @gabegamez1018
      @gabegamez1018 หลายเดือนก่อน +2

      I know I’m late, but the animation is looped, you can just turn the “looped” property of the loaded animation off and it will be fine

    • @ZiRR0
      @ZiRR0 2 วันที่ผ่านมา

      could be an issue with either the animation's properties (ex: looped), or its priority.

  • @skylrgreen
    @skylrgreen 2 หลายเดือนก่อน +1

    THANK YOU SO MUCH OMG I HAVE BEEN STUCK ON THIS FOR DAYS

  • @Appearedweird1
    @Appearedweird1 หลายเดือนก่อน +3

    hey i dont know if youll see this but a problem i had was everytime i got in kill range it stopped working how do i fix this

  • @AnnoyingGremlinCat
    @AnnoyingGremlinCat 2 หลายเดือนก่อน +2

    It works great, but I have one major issue with the ai.
    The enemy tends to sort of “have a seizure”, or, in other words, move back and forth at a rapid pace, as if it’s trying to find the next waypoint to go to occasionally, mostly when it loses sight of the player, and seems to do it more often when it’s been chasing the player for a long while.
    Do you think there may be a way to fix this?

  • @indominusplays2850
    @indominusplays2850 3 หลายเดือนก่อน +2

    Is there a way for you to make the monster switch animations? In the game im making I want the monster to start running when it locks on to you but theres no way to stop the other animation.

  • @Mr.Trainman
    @Mr.Trainman 4 วันที่ผ่านมา +1

    I need help, mine isn't moving or working

  • @cowkingrules
    @cowkingrules 6 วันที่ผ่านมา +1

    Hi rusty! I enjoyed your in depth approach on how to make the monster while still explaining what each line does. I do have one problem with my rig though. After it attacks the player and goes back to the waypoints, it continues doing the attack animation instead of the walking animation. Any ideas? I made sure the animation priorities are set correctly so that isn't it.

    • @HumanisticHuman
      @HumanisticHuman วันที่ผ่านมา

      Hey!! The problem here is the animation is turned on to loop. By turning off the loop, you can fix this problem. :))

  • @AkimichNoName
    @AkimichNoName 9 หลายเดือนก่อน +1

    Was thinking about it, thank you!

  • @JBGAMEEZ
    @JBGAMEEZ หลายเดือนก่อน +1

    HELP- I'm using your model and he goes around but he doesn't come for you and I changed the distance and all of that and it still don't work PLZ HELP SOMEONE

  • @vvg907
    @vvg907 7 หลายเดือนก่อน +3

    ( i learning english, so sorry anything 😅) I've been looking at pathfinding for a long time and every script I went through I found an error in the output:
    Stack Begin - Studio
    21:57:26.952 Script 'Workspace.HorrorMonster.PathfindingScript', Line 108 - function patrol - Studio - PathfindingScript:108
    21:57:26.953 Script 'Workspace.HorrorMonster.PathfindingScript', Line 117 - Studio - PathfindingScript:117
    21:57:26.953 Stack End - Studio
    Do you know how I can solve this?

    • @vvg907
      @vvg907 7 หลายเดือนก่อน

      and yes… i created a folder with parts and rename for Waypoints

    • @vvg907
      @vvg907 7 หลายเดือนก่อน

      I found this error, basically i not achored the waypoints, lol

  • @wutsigma
    @wutsigma 4 หลายเดือนก่อน +6

    i dont know whats happening but when i did all the scripts and everything he wont move around at all he just stands there and wont even kill you

    • @GreenNeonRoblox
      @GreenNeonRoblox 4 หลายเดือนก่อน +3

      same

    • @freglix
      @freglix 2 หลายเดือนก่อน

      is it anchored?

  • @RendleWasTaken
    @RendleWasTaken 9 หลายเดือนก่อน +2

    TYSM THIS HELPED ME ALOT!!!!😆

    • @Xmultie
      @Xmultie 5 หลายเดือนก่อน

      I will sub on all 3 of my accounts if you paste the script

  • @Glitcheddog
    @Glitcheddog 8 วันที่ผ่านมา +1

    is there anyway to make it so the script can work with r6?

  • @allgusontop
    @allgusontop 8 หลายเดือนก่อน +2

    From the BOTTOM of my heart, I LOVE YOU. I have searched for tutorials for a WHILE and none of them worked, but this worked. You don't know how much I genuienly love you bro. Really helpful that you explained this since I have a little bit of coding experience and therefore I made changes that suited my game, thanks for that too

    • @rustysillyband
      @rustysillyband  8 หลายเดือนก่อน

      Thank you for your encouraging words! They mean a lot to me. I appreciate you taking the time to write this message and I hope the best for you in all future endeavors. Thanks again, have an amazing day!

    • @raygupRBLX
      @raygupRBLX 6 หลายเดือนก่อน +1

      I agree!

    • @Unc1e_Jeff
      @Unc1e_Jeff 6 หลายเดือนก่อน

      @@rustysillyband can add the script somewhere to copy

  • @supermann270
    @supermann270 9 หลายเดือนก่อน +1

    Is this series going to be a horror game like the asylum? or something else. If something else, please inform me on it

    • @rustysillyband
      @rustysillyband  9 หลายเดือนก่อน +1

      Hi there! This series is simply covering every popular horror game mechanic so that you can create any horror game you would like. A few mechanics include:
      - Flashlight
      - Monsters
      - Jump scares
      - Objectives
      - Story
      - etc..
      Thank you for watching, have an amazing day!

    • @vale4you
      @vale4you 8 หลายเดือนก่อน

      @@rustysillyband Hey i have a problem. What if our model doesnt have Humanoidrootpart because we made it ourselves in blender?

  • @ryangoslingmemesOfficial
    @ryangoslingmemesOfficial หลายเดือนก่อน

    You are the complete goat i making a stealth game kind like hitman/splintercell and i couldnt for the life of me get a moving pathfinding npc thank you

  • @roblox-k9q2p
    @roblox-k9q2p 11 วันที่ผ่านมา

    My rig was not moving so I checked for errors, and it said Workspace.Rig.PathFindingScript:61: attempt to index nil with ‘CreatePath’ for line 61 of the PathfindingScript, can anyone help pls?

  • @Lxst-uu6fs
    @Lxst-uu6fs 8 วันที่ผ่านมา

    When I put the code on my monster he slides around and it makes it really easy to dodge and makes him slow down. Anyway to fix it

  • @Type653
    @Type653 หลายเดือนก่อน

    Thanks man, this will be useful for my game.

  • @Ixandeal
    @Ixandeal 15 วันที่ผ่านมา

    i doesnt work it says 91 (which is line 89 on his) is attempting to call a nill value? any ideas?

  • @GingerSnaps73256
    @GingerSnaps73256 4 หลายเดือนก่อน

    oh. my. god. THANK YOU SO MUCH OMG I ACTUALLY NEEDED THIS THANKS PLS KEEP IT UP

  • @raygupRBLX
    @raygupRBLX 6 หลายเดือนก่อน +2

    Great tutorial! you are one of those devs that actually explain things unlike the scam devs that make you script for like 500 hours and then nothing works; New subscriber great channel. Like personally I'm a small roblox dev but these tutorials are very good.

    • @Xmultie
      @Xmultie 5 หลายเดือนก่อน +1

      I will sub on all 3 of my accounts if you paste the script

  • @MatiBugati
    @MatiBugati 4 หลายเดือนก่อน +1

    does not work anymore i think i tried everything but isnt working for me

  • @RodsterInk
    @RodsterInk 5 หลายเดือนก่อน +1

    THE ONLY WORKING PATHFINDING I FOUND AND IT WAS EXPLAINED AMAZINGLY THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU
    (If you couldn't tell I'm quite thankfull for this)

  • @TajwarIslam-z8v
    @TajwarIslam-z8v วันที่ผ่านมา

    Yo, im a solo dev making a horror game watching your tuts, can you please tell me if there is any way you can add a chase music when the monster sees you, looking forward to your reply 👍 😀 l

  • @Roaaadii
    @Roaaadii 6 หลายเดือนก่อน +3

    my rig doesnt do anything. It doesnt move, it doesnt attack or anything. why is that?

    • @LilFellas123
      @LilFellas123 6 หลายเดือนก่อน

      Did you unanchored every part of the model?

  • @jjadeiscool
    @jjadeiscool 20 วันที่ผ่านมา

    help me please i tried to fix everything but the script works but it doesnt kill the player it goes to the player and try kill it but it the player doesnt die

  • @red40_1
    @red40_1 6 วันที่ผ่านมา

    is it okay if i use this script on a part with a humanoid in it? because when i tried nothing happened

  • @supermann270
    @supermann270 9 หลายเดือนก่อน +2

    Heyy Rusty! Its me again. I was working on my horror game with very little knowledge and I ran into an issue. I was wondering how to adjust the FirstPerson Script you made in your other video to make it where when GUI is visible it is unlocked, so that you can move your mouse around. Please let me know how to fix this!!

    • @rustysillyband
      @rustysillyband  9 หลายเดือนก่อน +1

      Hi there! You can simply create a screenGui with a textButton inside of it. After that, simply set the size of the textButton to (0,0,0,0) and tick the Modal property to true. This will allow you to move your mouse around in first person. Thanks for watching, have an amazing day!

  • @DragonKingGaming0
    @DragonKingGaming0 8 หลายเดือนก่อน +3

    I'm having a slight issue, the monster is not chasing the player, is it because I have a custom player model for the game? It could also be because my monster is large, idk
    Edit: found the issue, the problem is that I can't fix it, the reason why it isnt working is because its root part is higher than the player meaning it doesn't see the player, my problem is that I can't make my monsters legs smaller, is there any other fix?

    • @rustysillyband
      @rustysillyband  8 หลายเดือนก่อน +1

      You can try to increase the distance that it is able to attack from. Instead of doing 5, you can do 10. Other than that, you can move the RootPart down closer to his legs, but you will also have to edit the HipHeight in the Humanoid.
      Thanks for watching, have an amazing day!

    • @DragonKingGaming0
      @DragonKingGaming0 8 หลายเดือนก่อน +1

      @@rustysillyband thank you so much, I'll try what I can do

    • @DragonKingGaming0
      @DragonKingGaming0 8 หลายเดือนก่อน +1

      ​@@rustysillybandI resulted in using a different model (just an r6 block model) and the game the monster is for is like a backrooms type game, the problem is that it refuses to walk if placed on a part or if the way points are behind a wall (it's able to go around the wall it just won't)

  • @dodcherbomb
    @dodcherbomb 5 หลายเดือนก่อน

    thank you bro so much i just got your pack and ive been trying SO MUCH videos ignore the people who told you that it does not work at all they didnt follow ur steps! ur amazing dude..

    • @EmotionalCabbage12
      @EmotionalCabbage12 5 หลายเดือนก่อน

      Tell me how you did it

    • @dodcherbomb
      @dodcherbomb 5 หลายเดือนก่อน

      @@EmotionalCabbage12 your prbly did one mistake you might have not put waypoint folder with the parts

  • @huirzvgaming
    @huirzvgaming 9 หลายเดือนก่อน

    love the effort!

  • @SurvivalSteve
    @SurvivalSteve 2 หลายเดือนก่อน

    I nearly gave up on this being bad code but figured out if your npc is wearing accessories it will bug out and make it hard to detect the player. Im guessing its something to do with the raycast. Hope this helps somebody.

  • @dominictube6199
    @dominictube6199 8 หลายเดือนก่อน

    hey man! so i do have a few problems
    1. even if the AI is faster then you, it will stop in little tiny intervals, causing it to not kill you even if you cant outrun it via walkspeed difference
    2. i have barriers placed around the map, and if i am on the other side of the barrier the AI is, it will just walk to some other waypoint instead of continuing to chase me/going around the wall, i think this is generally because of how raycasting works

  • @britishmapping1759
    @britishmapping1759 5 หลายเดือนก่อน

    It mostly works but it completely ignores certian parts and tries to go through them, how do i fix it?

  • @therandomapple7543
    @therandomapple7543 6 หลายเดือนก่อน +1

    This is a great tutorial!

  • @patrick9292
    @patrick9292 3 หลายเดือนก่อน

    how do I make it so it will go through a set path instead of random?

  • @NoobyYT-og
    @NoobyYT-og หลายเดือนก่อน

    it keeps running away over and over, what to do?

  • @Atlos_GT
    @Atlos_GT หลายเดือนก่อน

    can anyone help me my rig will not move what so ever and i did all the code step by step the right way

  • @Chimpertagofficial
    @Chimpertagofficial หลายเดือนก่อน

    I spent like an hour and the script isn’t working nothing is anchored and it says there’s no errors please help me

  • @davealdrindeloso2797
    @davealdrindeloso2797 3 หลายเดือนก่อน

    The problem with this model I don't like
    Is that I like my horror game to have multiple monsters
    But when i saw
    Local function(Ondeath)
    My dreams we're crushed.

  • @burbyyy
    @burbyyy 6 หลายเดือนก่อน

    OMG FINALLY A TUTORIAL THAT WORKS I CANNOT EXPLAIN HOW GRATEFUL I AM!!!!!

  • @InkVerseEdits
    @InkVerseEdits 9 หลายเดือนก่อน

    as always good job

  • @BananaBunchGTAG
    @BananaBunchGTAG 4 หลายเดือนก่อน

    Can someone help it says: Workspace.rig.PathFindingScript:87: invalid argument #2 to ‘random’ (interval is empty) pls help me

  • @storylynnegoss1565
    @storylynnegoss1565 5 หลายเดือนก่อน

    Thanks alot man I am making a game but the monster you made for thr kit was not to my liking so I took the script from this one and put it into my Monster so its extra scary so yeah preciate it man

  • @nicolaslikeswater
    @nicolaslikeswater 8 หลายเดือนก่อน +15

    Script if you're too lazy to type it (not organized like in the vid):
    local Players = game:GetService("Players")
    local PathfindingService = game:GetService("PathfindingService")
    local rig = script.Parent
    local function checkForCharacter(character)
    local rayOrigin = rig:FindFirstChild("HumanoidRootPart").Position
    local rayDirection = (character.HumanoidRootPart.Position - rayOrigin).Unit * 40

    local raycastResult = workspace:Raycast(rayOrigin, rayDirection, RaycastParams.new())

    if raycastResult then
    local raycastInstance = raycastResult.Instance
    if raycastInstance:IsDescendantOf(character) then
    return true
    end
    else
    return false
    end
    end
    local function findNearestPlayer()
    local players = Players:GetPlayers()
    local nearestPlayer = nil
    local maxDistance = 40
    for _, player in pairs(players) do
    if player.Character = nil then
    local targetCharacter = player.Character
    local distance = (rig.HumanoidRootPart.Position - targetCharacter.HumanoidRootPart.Position).Magnitude

    if distance < maxDistance and checkForCharacter(targetCharacter) then
    nearestPlayer = targetCharacter
    maxDistance = distance
    end
    end
    end
    return nearestPlayer
    end
    local function attack(character)
    local distance = (rig.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Magnitude

    if distance > 5 then
    rig.Humanoid:MoveTo(character.HumanoidRootPart.Position)
    else
    character.Humanoid.Health = 0
    end
    end
    local function calculatePath(destination)
    local agentParams = {
    ["AgentHeight"] = 5.5
    ["AgentRadius"] = 4,
    ["AgentCanJump"] - false
    }

    local path - PathfindingService:CreatePath(agentParams)
    path:ComputeAsync(rig.HumanoidRootPart.Position, destination)
    return path
    end
    local function walkToDestination(destination)
    local path - calculatePath(destination)

    if path.Status == Enum.PathStatus.Success then
    for _, waypoint in pairs(path:GetWayPoints()) do
    local nearestPlayer = findNearestPlayer()
    if nearestPlayer then
    attack(nearestPlayer)
    break
    else
    rig.Humanoid.MoveTo(waypoint.Position)
    rig.Humanoid.MoveToFinished:Wait()

    end
    end
    else
    rig.Humanoid:MoveTo(destination - (rig.HumanoidRootPart.CFrame.LookVector * 10))

    end
    end
    local function patrol()
    local waypoints = workspace.Waypoints:GetChildren()
    local randomNumber = math.random(1, #waypoints)

    walkToDestination(waypoints[randomNumber].Position)
    end
    while task.wait(0.3) do
    patrol()
    end

    • @hamstercult6599
      @hamstercult6599 7 หลายเดือนก่อน

      TYSMMMM

    • @Unc1e_Jeff
      @Unc1e_Jeff 6 หลายเดือนก่อน

      Bro saved me lol

    • @CoolManMMusic
      @CoolManMMusic 5 หลายเดือนก่อน

      [AgentRadius] has a red line through it

    • @gog-n5y
      @gog-n5y 4 หลายเดือนก่อน

      you messed up a couple of things but i fixed them

    • @realchillroblox79
      @realchillroblox79 3 หลายเดือนก่อน

      thanks im very lazy

  • @LionAir737RBLX
    @LionAir737RBLX 8 หลายเดือนก่อน

    well it works, but it didn't go to the part it goes to the other Rig Model and if i delete the other rig model, the rig doesn't move

  • @Flairex
    @Flairex 7 หลายเดือนก่อน

    Great vid! Im currentlt working on a smart AI which will chase the player until it can't see them anymore. If it can't see the player, it will continue in the direction the player went to try and gaun sight of them again. I'm having a lot of issue with the code but It's almost done I can feel it

  • @EXTRAPEOPLE2477
    @EXTRAPEOPLE2477 5 หลายเดือนก่อน

    i was playing with it and it keeps on going into random blocks do you know how to fix it

  • @amogusus911
    @amogusus911 5 หลายเดือนก่อน

    Thank you so much for this tutorial, it really helps for my horror game.
    Do you have another tutorial that can help add a jump scare if the player is touched by the rig? thank you

    • @Xmultie
      @Xmultie 5 หลายเดือนก่อน +1

      I will sub on all 3 of my accounts if you paste the script

  • @EzraGamez845
    @EzraGamez845 7 หลายเดือนก่อน

    Wait… what if I just tied a part from the waypoints to the player, make it invisible so there isn’t just a cube on top of the player, tie a part to the monster that does damage, and just make the monster go for the waypoint?
    (Btw I haven’t tried using this yet but I will next week so im not saying that it doesn’t work.)

  • @benjoyrhnw1679
    @benjoyrhnw1679 9 หลายเดือนก่อน +2

    hi bro idk if ur going to read this but pls make me a horror looking thing in that game and send the link of body parts pls im sub

    • @rustysillyband
      @rustysillyband  9 หลายเดือนก่อน

      Hi there! You can find the free model of the monster I used in the description of the video. Thank you so much for watching, have a blessed day!

  • @BluAppol
    @BluAppol 6 หลายเดือนก่อน

    rustysillyband i tried working it out but when i try the local functions wont get called why?
    please help

  • @WHIMSY-op8zw
    @WHIMSY-op8zw หลายเดือนก่อน

    how do you add a face to a rig

  • @RaihanShejeer
    @RaihanShejeer 23 วันที่ผ่านมา

    Guys help, the script works good, but when the rig gets to a waypoint it suddenly twitches about 2 to 3 times, then going to another waypoint, please fix

  • @Autricious
    @Autricious 5 หลายเดือนก่อน

    This guy puts out the best roblox studio tutorials.

    • @Xmultie
      @Xmultie 5 หลายเดือนก่อน

      I will sub on all 3 of my accounts if you paste the script

    • @Izon14n
      @Izon14n 5 หลายเดือนก่อน

      @@Xmultier u lazy? Just do it 😑

    • @Xmultie
      @Xmultie 5 หลายเดือนก่อน

      @@Izon14n I just paid somone 20$ to do it for me💀

  • @OfficialJello
    @OfficialJello 9 หลายเดือนก่อน +1

    This is so helpful! Thanks!

    • @rustysillyband
      @rustysillyband  9 หลายเดือนก่อน

      Thanks for watching, have a blessed day!

    • @Xmultie
      @Xmultie 5 หลายเดือนก่อน

      I will sub on all 3 of my accounts if you paste the script

  • @SuperEpicAnimation
    @SuperEpicAnimation 6 หลายเดือนก่อน

    this actully works, thank you

  • @EmmaKohut-o5f
    @EmmaKohut-o5f 4 หลายเดือนก่อน

    This is perfect but my map has walls and my rig keeps running into them... Anyway i can stop that without having to change my whole map?

  • @Chimpertagofficial
    @Chimpertagofficial หลายเดือนก่อน

    When I run it he just turns around and doesn’t walk or anything

  • @Cautiye
    @Cautiye 6 หลายเดือนก่อน

    thanks for the tutorial, this was actually my first long script that actually worked, just one thing, my monster commonly gets stuck on walls after a couple of patrols, as he picks a waypoint on the other side of the map, is there a way to fix that?

  • @vNoahlol
    @vNoahlol 8 หลายเดือนก่อน

    When the Monster is chasing me, it’s moving but it’s stopping every second now can you fix this?

  • @aykutdemirci3259
    @aykutdemirci3259 6 หลายเดือนก่อน

    can you please make another video about fixing the bug on your model? When the waypoints are behind a wall he just hugs the wall instead of going around it...

  • @arin_aroaro_arin8142
    @arin_aroaro_arin8142 6 หลายเดือนก่อน

    when i add the rig it doesn't move. How can i fix this?

  • @evazan1973
    @evazan1973 2 หลายเดือนก่อน

    it is saying on script 45 attempt to index function with "HumanoidRootPart"

  • @Funkyroblox
    @Funkyroblox 5 หลายเดือนก่อน +1

    Please help me i downloaded it but it wont move

  • @altaccount4710
    @altaccount4710 4 หลายเดือนก่อน

    What if my dummy can't move how can I fix it 😢

  • @luigifernando_
    @luigifernando_ 5 หลายเดือนก่อน +3

    i did everything in the script but the npc doesn't follow the player, just goes to waypoints
    i tried using your model and that doesn't follow the player either

    • @freglix
      @freglix 2 หลายเดือนก่อน

      try this
      local PathfindingService = game:GetService("PathfindingService")
      local npc = script.Parent
      local humanoid = npc:WaitForChild("Humanoid")
      local hrp = npc:WaitForChild("HumanoidRootPart")
      hrp:SetNetworkOwner(nil)
      local walkAnim = humanoid.Animator:LoadAnimation(script.Walk)
      local attackAnim = humanoid.Animator:LoadAnimation(script.Attack)
      local pathParams = {
      AgentHeight = 5,
      AgentRadius = 3,
      AgentCanJump = true,
      }
      local rayParams = RaycastParams.new()
      rayParams.FilterType = Enum.RaycastFilterType.Blacklist
      rayParams.FilterDescendantsInstances = {npc}
      local lastPos
      local animPlaying = false
      local RANGE = 60
      local DAMAGE = 100
      local function canSeeTarget(target)
      local orgin = hrp.Position
      local direction = (target.HumanoidRootPart.Position - hrp.Position).Unit * RANGE
      local ray = workspace:Raycast(orgin, direction, rayParams)

      if ray and ray.Instance then
      if ray.Instance:IsDescendantOf(target) then
      return true
      else
      return false
      end
      else
      return false
      end
      end
      local function findTarget()
      local players = game.Players:GetPlayers()
      local maxDistance = RANGE
      local nearestTarget

      for i, player in pairs(players) do
      if player.Character then
      local target = player.Character
      local distance = (hrp.Position - target.HumanoidRootPart.Position).Magnitude

      if distance < maxDistance and canSeeTarget(target) then
      nearestTarget = target
      maxDistance = distance
      end
      end
      end

      return nearestTarget
      end
      local function getPath(destination)
      local path = PathfindingService:CreatePath(pathParams)

      path:ComputeAsync(hrp.Position, destination.Position)

      return path
      end
      local function attack(target)
      local distance = (hrp.Position - target.HumanoidRootPart.Position).Magnitude
      local debounce = false

      if distance > 5 then
      humanoid:MoveTo(target.HumanoidRootPart.Position)
      else
      if debounce == false then
      debounce = true

      npc.Head.AttackSound:Play()
      attackAnim:Play()
      target.Humanoid.Health -= DAMAGE
      task.wait(0.5)
      debounce = false
      end
      end
      end
      local function walkTo(destination)
      local path = getPath(destination)

      if path.Status == Enum.PathStatus.Success then
      for i, waypoint in pairs(path:GetWaypoints()) do
      path.Blocked:Connect(function()
      path:Destroy()
      end)

      if animPlaying == false then
      walkAnim:Play()
      animPlaying = true
      end

      attackAnim:Stop()

      local target = findTarget()

      if target and target.Humanoid.Health > 0 then
      lastPos = target.HumanoidRootPart.Position
      attack(target)
      break
      else
      if waypoint.Action == Enum.PathWaypointAction.Jump then
      humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
      end

      if lastPos then
      humanoid:MoveTo(lastPos)
      humanoid.MoveToFinished:Wait()
      lastPos = nil
      break
      else
      humanoid:MoveTo(waypoint.Position)
      humanoid.MoveToFinished:Wait()
      end
      end
      end
      else
      return
      end
      end
      local function patrol()
      local waypoints = workspace.Waypoints:GetChildren()
      local randomNum = math.random(1, #waypoints)
      walkTo(waypoints[randomNum])
      end
      while task.wait(0.2) do
      patrol()
      end

    • @freglix
      @freglix 2 หลายเดือนก่อน

      and add the animation of attack and walk in it

    • @stilldust3
      @stilldust3 หลายเดือนก่อน

      @@freglix I tried this because the old scripts didn't work and this also doesnt work i dont know why

    • @freglix
      @freglix หลายเดือนก่อน

      @@stilldust3 then i don't know sorry

    • @freglix
      @freglix หลายเดือนก่อน

      also is it anchored?

  • @Sirfearair
    @Sirfearair 5 หลายเดือนก่อน

    Im having trouble with the animation not working

  • @leps6658
    @leps6658 5 หลายเดือนก่อน

    What if i used a mesh with a humanoid root part? Is that works?

  • @Lonestar222
    @Lonestar222 8 หลายเดือนก่อน

    Mine is not moving when I play it but is moving while I run it
    Any help?

  • @Brandonsletsplay
    @Brandonsletsplay 5 หลายเดือนก่อน

    For some reason the monster in my game just slides across the map and it doesn't go towards any of the waypoints and it doesn't chase or kill the player

    • @Mason-xd8ph
      @Mason-xd8ph 4 หลายเดือนก่อน

      lmao you ever get that fixed

    • @Brandonsletsplay
      @Brandonsletsplay 4 หลายเดือนก่อน

      No I ended up using another script

    • @bigpenguins9904
      @bigpenguins9904 9 วันที่ผ่านมา

      @Brandonsletsplay can u drop the script? I have the EXACT same problem with an imported model.

  • @VenomousPegasus
    @VenomousPegasus 9 หลายเดือนก่อน

    Can you please make a tutorial that’s pretty much opposite to this? One about a little creature that runs around randomly, and when a player gets close it runs away unless the player is crouched? Then if the player is crouched they can sneak up to it and pet it

    • @rustysillyband
      @rustysillyband  9 หลายเดือนก่อน +1

      Interesting idea! Thanks for watching!

  • @maliominis
    @maliominis 7 หลายเดือนก่อน +14

    The code doesn't work I tried to check for Errors and it looks the same as yours but the rig just stands there

    • @BrodyPlayzz
      @BrodyPlayzz 6 หลายเดือนก่อน +2

      Does it have a humanoid, a humanoidrootpart? Is it anchored?

    • @RoboticsAstrolot
      @RoboticsAstrolot 6 หลายเดือนก่อน

      Bro is just a hater

    • @Goofball760
      @Goofball760 6 หลายเดือนก่อน +12

      @@RoboticsAstrolotbro just cause it has an error does not mean he’s a hater 😭

    • @StBacon2
      @StBacon2 6 หลายเดือนก่อน +4

      Oh i forgot to anchor the humanoidrootpart

    • @Castleokayalridk_12334
      @Castleokayalridk_12334 4 หลายเดือนก่อน

      Shut yo goofy mouth up he is an hater he's just lying or he typed it wrong ​@LbmrichOfficial

  • @V3cto44
    @V3cto44 2 หลายเดือนก่อน

    W vid also does anyone else think that this guy sound like Brian griffin? (No Offence)

  • @AydanHuzayl64
    @AydanHuzayl64 2 วันที่ผ่านมา

    whats that star symbol?

  • @Autricious
    @Autricious 5 หลายเดือนก่อน

    You just got a like from me 😊.

  • @freglix
    @freglix 2 หลายเดือนก่อน

    how can i change the amount of damage

  • @God_scarqqplayz7
    @God_scarqqplayz7 6 หลายเดือนก่อน

    how can you reset the position of the monster after you die???

  • @bh2b8121
    @bh2b8121 8 หลายเดือนก่อน

    bro i upload the code from your free model to another fresh rig unchanged and he gives up while walking to one and goes to a different one an repeats

    • @rustysillyband
      @rustysillyband  8 หลายเดือนก่อน

      Hi there! Did you make sure to create your animations for the rig?

  • @CDMjet
    @CDMjet หลายเดือนก่อน

    from the bottom of my heart i wanna thank you so much bro just know youre an amazing person and Jesus and God love you God Bless dude :)

    • @rustysillyband
      @rustysillyband  หลายเดือนก่อน

      Thank you so much! God bless you too! 🙏

  • @natgobrrOW
    @natgobrrOW 8 หลายเดือนก่อน

    w tutorial, love it

  • @Egg0395
    @Egg0395 9 หลายเดือนก่อน

    I keep having line 62 of code not work? It says " HumanoidRootPart is not a valid member of Folder "Workspace.Waypoints"" do you know how to fix this?

  • @FrostyGamer160
    @FrostyGamer160 8 หลายเดือนก่อน

    Hey I didn’t see the parts in the waypoints folder

  • @Windy021
    @Windy021 4 หลายเดือนก่อน

    0:01 SHOOT AND EAT NOOBS REFRENCE????

  • @porta1master096
    @porta1master096 6 หลายเดือนก่อน

    I have one question. who's better at pathfinding?
    Rusty or gnomecode

  • @CoOpLegends
    @CoOpLegends 7 หลายเดือนก่อน

    is there a way to make the speed of the monster faster? great vid btw

    • @rustysillyband
      @rustysillyband  7 หลายเดือนก่อน

      Yes there is! Try changing the walkspeed property inside of the humanoid that's inside of your monster. Thanks for watching, have an amazing day!

    • @CoOpLegends
      @CoOpLegends 7 หลายเดือนก่อน

      Thanks man

  • @sumitrawat9931
    @sumitrawat9931 9 หลายเดือนก่อน +8

    it is not moving

    • @skorpion090
      @skorpion090 8 หลายเดือนก่อน +2

      Is it anchored? If yes unachor it

    • @urfav_lilyxx
      @urfav_lilyxx 8 หลายเดือนก่อน +1

      @@skorpion090if I unanchor it then it falls apart

    • @nacho_iscool3
      @nacho_iscool3 7 หลายเดือนก่อน

      Make sure it has an animation and unanchored

    • @Flairex
      @Flairex 7 หลายเดือนก่อน

      Little late here
      If you're unanchoring it and it falls apart, it's because it doesn't have any motor6ds. Likely your model isn't properly rigged

    • @urfav_lilyxx
      @urfav_lilyxx 7 หลายเดือนก่อน

      @@Flairex is there a way to get proper rigs ?

  • @blu17-0
    @blu17-0 5 หลายเดือนก่อน

    Mine doesn’t follow me it said magnitude is not valid member of vector3
    Edit: fixed it but he isn’t able to kill me

  • @Nomi-i5w
    @Nomi-i5w 4 หลายเดือนก่อน

    Yo i followed the entire tutorial but my rig wont even move, could u please send the script?

  • @yassingamer1837
    @yassingamer1837 7 หลายเดือนก่อน

    my monster doesen't walk what should i do?

  • @CDMjet
    @CDMjet หลายเดือนก่อน

    ty bro!

  • @MadReis10
    @MadReis10 6 หลายเดือนก่อน

    Hey I did every thing correct but it didn’t work I really need a monster for my game

  • @PersonHEHE-gw8sp
    @PersonHEHE-gw8sp 19 วันที่ผ่านมา

    My monster's feet just fall through the floor but the rest of him stay above ground

  • @BatteriesRULE
    @BatteriesRULE หลายเดือนก่อน

    It doesn't work, when I tried to test it, it just stood there. But are you on PC? I am on Mac, that's probably the problem.

  • @Babymoonleader
    @Babymoonleader 8 หลายเดือนก่อน

    how do i add an idle anim to it