Advanced Roblox Scripting Tutorial #22 - Magnitude (Distance) [Beginner to Pro 2019]

Поділитися
Вставка
  • Опубліковано 7 лют 2025
  • Advanced Roblox Scripting Tutorial #22 - Magnitude (Distance) [Beginner to Pro 2019]
    Hey guys! Welcome back to another advanced roblox scripting tutorial. In today's video I will be explaining magnitude in roblox stuido. Basically how to find the distance between two parts in roblox. It's how you measure distance. The easiest way at least. I used to try to subtract the Vector3 positions and stuff until I found magnitude lol. Thankfully I'm not that bad of a scripter anymore. Anyways super cool stuff coming. I also teach you how to make a Zombie AI that follows you. It's pretty cool :)
    -Join my Discord Server to learn and meet other developers!-
    / discord
    -- Follow me on twitter! (my name is tapwater because thats my main channel): / realtapwater
    -- Follow me on Instagram! (my name is tapwater because of my main channel): / realtapwater
    Link to Beginner's Tutorial Series:
    • Beginner's Roblox Scri...
    --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!

КОМЕНТАРІ • 317

  • @TheDevKing
    @TheDevKing  5 років тому +49

    HEYy guys! Be sure to join the discord server to stay connected, meet other devs, and learn!: discord.gg/FKcSyRh

    • @dragonmaster4548
      @dragonmaster4548 5 років тому

      ur first comment lol

    • @rosultra4067
      @rosultra4067 4 роки тому

      Why would it need to be subtracted when calculating the magnitude?

    • @rosultra4067
      @rosultra4067 4 роки тому

      It says "The current identity (2) cannot Class security check (lacking permission 6)" what should I do? My Code:
      local ztorso = script.Parent.Torso
      local zhumanoid = script.Parent.Humanoid
      function walker()
      local agro = 100
      local target = nil
      for i,v in pairs(game:GetChildren()) do
      local human = v:FindFirstChild("Humanoid")
      local torso = v:FindFirstChild("Torso")
      if human and torso and v ~= script.Parent then
      if (ztorso.Position - torso.Position).magnitude < agro then
      agro = (ztorso.Position - torso.Position).magnitude
      print("found em")
      target = torso
      end
      end
      end
      return target
      end
      while true do
      wait(3)
      local s = walker()
      if s then
      zhumanoid:MoveTo(s.Position)
      else
      zhumanoid:MoveTo(Vector3.new(math.random(-10,10),0,math.random(-10,10)))
      end
      end

    • @ali.2412
      @ali.2412 4 роки тому

      @@rosultra4067 do
      while wait(1) do

    • @saidabdiche5890
      @saidabdiche5890 4 роки тому

      @@ali.2412 i think we can use pathfinding service (i think that's will work)

  • @superduperman8287
    @superduperman8287 2 роки тому +25

    this was honestly the funniest, and fun-est video in the entire series so far. I like when he puts jokes, it really brightens the mood and makes it more fun to learn.

  • @chickenoodle3397
    @chickenoodle3397 5 років тому +68

    You're the champion Tap.
    The reason why your the champ is you can easily upload on your big channel and get thousands of views but you choose to upload here.
    I really appreciate it man i'm understanding more and more and i really enjoy scripting and cant wait for more videos to come!

    • @TheDevKing
      @TheDevKing  5 років тому +31

      So glad I could help :)
      My goal is to teach everyone that wants to learn scripting how to script. Even if you have no experience!

    • @duckking404
      @duckking404 4 роки тому +4

      fart

    • @kingpig8732
      @kingpig8732 3 роки тому +2

      @@duckking404 i agree

    • @InfinityBS
      @InfinityBS 3 роки тому +1

      @@duckking404 i also agree

    • @plastibonic
      @plastibonic Рік тому

      @@duckking404 very true

  • @splishymancity
    @splishymancity 4 роки тому +28

    Kudos to you for being able to teach coding greatly . It's so hard to use your voice loudly without stuttering wanting to be able to process the information you can.

  • @oaki_tk
    @oaki_tk 2 роки тому +13

    "They got an upper torso,"
    **clicks lower torso**
    "And they got a lower torso."
    **clicks upper torso**
    great tutorial btw

    • @alexflame9383
      @alexflame9383 2 роки тому

      Bro I literally just saw that and decided to scroll down in the comments, Lol 🤣

  • @gurpreetsekhon151
    @gurpreetsekhon151 2 роки тому +26

    Anyone who is experiencing problems, but aren't getting any errors in the output:
    Check that the *HumanoidRootPart* of your NPC is Anchored. If it is Anchored then your NPC can't move, even after being instructed to. This confounded me for a few days. I know I can't be the only person who encountered this, so please like this comment for exposure.

  • @developerrk384
    @developerrk384 4 роки тому +72

    i like how you used my name as the bot

    • @Cadmium141
      @Cadmium141 4 роки тому +4

      lol

    • @rosultra4067
      @rosultra4067 4 роки тому +10

      it's rick astley

    • @akanoxy391
      @akanoxy391 3 роки тому

      @@Cadmium141 are you actually dream

    • @RealCalamity
      @RealCalamity 3 роки тому +2

      @@akanoxy391 No, it’s quite obvious that it isn’t him.

    • @akanoxy391
      @akanoxy391 3 роки тому +3

      @@RealCalamity Great. You’ve made my wife pregnant.

  • @dripbingus4224
    @dripbingus4224 4 роки тому +63

    I WILL NEVER GONNA GIVE UP ABOUT SCRIPTING

  • @ipoststuff.2564
    @ipoststuff.2564 4 роки тому +43

    The advanced scripting playlist is over 10 hours long.
    If you've made it here you should be proud of yourself!
    And also thanks to TheDevKing for spending probably well over 10 or 20 hours making these tutorials for us!

    • @RichRBLX
      @RichRBLX 3 роки тому +1

      ive officially finished them, though some I skim watched them (such, as animations, sounds and welds)

    • @nvermr
      @nvermr 2 роки тому

      @@RichRBLX me too

  • @thexd5871
    @thexd5871 3 роки тому +8

    i really like the way you talk to the NPC

  • @okinawakor
    @okinawakor Місяць тому

    this guy so jolly it makes me smile

  • @netidk
    @netidk 2 роки тому

    holy crap dude. im literally 4 minutes in this lesson and i already got my problem solved. thank you!

  • @jxrdxn4623
    @jxrdxn4623 4 роки тому +4

    omg first it did work and i started crying, then it was just because I need to add a ")' at the end of the vector 3 randomizer. Nice vid

  • @Oof_the_gamer
    @Oof_the_gamer 9 місяців тому +1

    for people who don't understand why we're lowing down the magnitude, It's because we want the Npc to focus on the one target because if multiple, it would start doing something weird

  • @MineCat_minecraft
    @MineCat_minecraft 2 місяці тому +1

    I didnt knew, how useful it is, before 1:10

  • @somerandomdude9712
    @somerandomdude9712 3 роки тому +9

    The fact that Rick is actually Rick Astley

  • @GreenBitWasTaken
    @GreenBitWasTaken 3 роки тому +4

    4:38 TheDevKing: "so that's why they're considered 12 studs away"
    Captions: "so that's why they're considered 12 cells away"

  • @waterhd1834
    @waterhd1834 4 роки тому +11

    When your printing it and you just want a number without a decimal use
    print(math.floor(distance))

    • @Jappley
      @Jappley Рік тому +2

      print(math.floor(distance) or math.ceil(distance))

    • @Lxmitless7
      @Lxmitless7 11 місяців тому +1

      print(math.round(distance))

  • @jordankidd230
    @jordankidd230 3 роки тому +3

    i am filling a whole notebook with information from your videos

    • @Masterlulu
      @Masterlulu 5 місяців тому

      2 years later but same lol

  • @justagenosfan
    @justagenosfan 4 роки тому +9

    The entire viewerbase just got rickrolled

  • @cosmo1362
    @cosmo1362 5 років тому +9

    nice tutorials :)

  • @HUNGNGUYEN-hi8vr
    @HUNGNGUYEN-hi8vr Рік тому

    Also cool that you made a zombie. That helps a LOT. I can litterally now make my own Enemy

  • @IvanGarcia-cx5jm
    @IvanGarcia-cx5jm 2 роки тому +2

    When the positions are subtracted the difference should have sign (negative or positive). The "Magnitude" method should be the one that gets rid of the sign, and therefore the order of subtraction does not matter.

  • @monstertrident1180
    @monstertrident1180 2 роки тому +1

    tap we need the zombie ai series.. please! I know you probably won't see my comment because you're busy and stuff but you said it in your video right here: 5:55, so please can you make a series?

  • @thinkingbacon
    @thinkingbacon 2 роки тому

    TheDevKing is probably the best Roblox scripting teacher on the entire UA-cam platform. He explains everything so well and if you don't understand something he says you will probably figure it out by the end of the video. Great videos! keep it up.👍

    • @pristinplayz8946
      @pristinplayz8946 2 роки тому

      nah the devking is nothing compared to alvinblox

  • @TruckerxMGDx
    @TruckerxMGDx 2 роки тому +1

    Great job , great simple explanation with every line. Superb. Thank you

  • @6y428
    @6y428 4 роки тому +10

    1:30 im not gonna do that zombie script.
    subtitles:Zambia strips

  • @bluestone824
    @bluestone824 3 роки тому +4

    when will he realize that he has been rickrolling himself this entire time..

  • @jordankidd230
    @jordankidd230 3 роки тому +3

    you could have made lots of money teaching these lessons but instead you upload them for anyone to learn for free, thank you

  • @notharusoru1554
    @notharusoru1554 3 роки тому +2

    I was the 1,000 like

  • @goldengamer9171
    @goldengamer9171 4 роки тому +1

    Dude u helped me so much I can learn how to make a zombieai

  • @catsEeter
    @catsEeter 3 роки тому +1

    Cool another part!

  • @jannikkimjensen1433
    @jannikkimjensen1433 4 роки тому +1

    best roblox tutorial ever!

  • @diamondcomplex2376
    @diamondcomplex2376 4 роки тому +14

    This is my first time getting rick rolled in roblox, hope it's my last

    • @actorman3895
      @actorman3895 4 роки тому

      hey i like ur adult vids made me big

    • @diamondcomplex2376
      @diamondcomplex2376 4 роки тому

      @@actorman3895 wat?? I don't understand a single thing you said you ding dong

    • @diamondcomplex2376
      @diamondcomplex2376 4 роки тому +1

      @@actorman3895 you've watched too much pornhub you dumbfuck

    • @1gamer988
      @1gamer988 4 роки тому

      Hi

    • @kingpig8732
      @kingpig8732 3 роки тому +1

      @@actorman3895 SUS

  • @hamster8706
    @hamster8706 4 роки тому +12

    Use FindFirstChildOfClass("Humanoid") Instead of FindFirstChild("Humanoid") so it can attack all characters that have humanoid not characters that have humanoid named "Humanoid"

    • @per_cept
      @per_cept 4 роки тому

      findfirstchild finds the first item named humanoid, findfirstchildofclass finds the first child that is a specific class

    • @hamster8706
      @hamster8706 4 роки тому +1

      @@per_cept Yeah i know.

    • @Xelarix
      @Xelarix 4 роки тому +1

      @@per_cept REALLY??? i wouldnt have guessed

    • @MarioMario-yb3iz
      @MarioMario-yb3iz 4 роки тому

      @@Xelarix k

    • @Xelarix
      @Xelarix 4 роки тому

      @@MarioMario-yb3iz "k" what?

  • @bluestone824
    @bluestone824 3 роки тому

    tysm ur the best I thank u like crazy thank u so much ur the best utuber

  • @dimamelonplayground
    @dimamelonplayground Рік тому

    Thank you now I can make detection for my stealth/loud game

  • @jacobnoobmaster
    @jacobnoobmaster 2 роки тому

    Thanks! This Helped Alot!

  • @marble7476
    @marble7476 4 роки тому +2

    Imagine not being subscribed, can't relate

  • @gamersam1925
    @gamersam1925 5 років тому +3

    Great tutorial

  • @buneon4462
    @buneon4462 3 роки тому +1

    when he counted to nine I knew what he meant but i laughed hysterically

  • @drivenexcuse3997
    @drivenexcuse3997 11 місяців тому

    A good way to learn everything about scripting is watch all of his playlist videos so you know everything there is to know to make a good game, and list the tutorials that you think he didnt make sense in, then look up other tutorials for those thing's because other people may explain in a different way that might make more sense. And also dont sit there and be stuck, if it dont work after trying multipule times its prolly outdated, these videos kinda old

  • @SamLeroSberg
    @SamLeroSberg 3 роки тому +2

    So instead of using a sphere hitbox, I used magnitude instead, cuz I hate lag

  • @fatdog36
    @fatdog36 5 років тому +6

    RIP Rick

  • @BatyaChad
    @BatyaChad 2 роки тому

    omg very cool tutorial

  • @dracogone3682
    @dracogone3682 3 роки тому +1

    idk know why but your voice kinda sounds like a deeper versiom of Mclovin from SuperBad

  • @rubenwiebe5816
    @rubenwiebe5816 2 роки тому +5

    Minor improvement to the zombie tracking
    while wait() do
    local torso=findTarget()
    if torso then
    zombHumanoid:MoveTo(torso.Position)
    else
    wait(1)
    zombHumanoid:MoveTo(zombTorso.Position+Vector3.new(math.random(-50,50),0,math.random(-50,50)))
    end
    end
    by making it wait() and adding wait(1), the zombie will redirect itself much more frequently and still roam around normally. This probably won't matter cause this zombie script is too simple for any big game but it's fun to mess around 🗿

    • @spriteman1925
      @spriteman1925 Рік тому

      bro using wait() isnt usefull at that point just use runservice gosh darn u just ruined the point of it heres an actual improvement
      local rs = game:GetService("RunService")
      local function update()
      local torso=findTarget()
      if torso then
      zombHumanoid:MoveTo(torso.Position)
      else
      wait(1)
      zombHumanoid:MoveTo(zombTorso.Position+Vector3.new(math.random(-50,50),0,math.random(-50,50)))
      end
      end
      rs.Heartbeat:Connect(update)

  • @ricefieldman
    @ricefieldman 4 роки тому +2

    Agro, slang/ short for Aggravated :)

  • @thecheeseclanwastake
    @thecheeseclanwastake 4 роки тому +5

    code:
    local zombieTorso = script.Parent.Torso
    local zombieHumanoid = script.Parent.Humanoid
    local function findTargret()
    local agroDis = 1000
    local Targret = nil
    for i, v in pairs(game.Workspace:GetChildren()) do
    local human = v:FindFirstChild("Humanoid")
    local torso = v:FindFirstChild("Torso")
    if human and torso and v ~= script.Parent then
    if (zombieTorso.Position - torso.Position).magnitude < agroDis then
    agroDis = (zombieTorso.Position - torso.Position).magnitude
    Targret = torso

    end
    end
    end
    return Targret
    end
    while wait(1) do
    local torso = findTargret()
    if torso then
    zombieHumanoid:MoveTo(torso.Position)
    end
    end

    • @reiko1945
      @reiko1945 3 роки тому +1

      tysm bro, the only problem i had was that i put the script in the workspace instead of the actual Zombie xd silly me.
      i wouldnt of found out ;D

  • @dafidaga7472
    @dafidaga7472 4 роки тому +2

    does anyone know a script if there is a lot of spawns in a game
    but we want to make 1 spawn as the start spawn where all the players that join spawns there
    at the start spawn?
    please im making a game ,
    its kind of a escape obby game
    but everytime a second player join they spawn in the second stage im so confused why that happend
    i want it to start at the start point
    please someone:(

  • @joshuamuchnik3676
    @joshuamuchnik3676 4 роки тому +3

    i was able to make it so when the zombie gets close to the npc the npc starts running around

    • @davo7612
      @davo7612 4 роки тому +2

      just did it too and published it as a game

    • @arunmoses2197
      @arunmoses2197 3 роки тому

      Cool!

  • @kkrkf424
    @kkrkf424 2 роки тому

    very good tutorial but can i ask:
    how to make the zombie search humanoid again after he found and killed one?

  • @myusernameskitty1230
    @myusernameskitty1230 3 роки тому +1

    what if the "zombie" is a bullet, how do you make the bullet go to the zombie???

  • @Avinomus
    @Avinomus 3 роки тому +1

    This is so helpfull

  • @baaloctopasgaming4587
    @baaloctopasgaming4587 2 роки тому

    If you are making a killer with magnitude make sure to use pathfinding service

  • @joshuahickerson6469
    @joshuahickerson6469 4 роки тому +3

    If there were multiple characters around, this would still work right? It would find the nearest character to track instead of breaking all together, because for some reason that's what mine is doing..

    • @InfinityBS
      @InfinityBS 3 роки тому

      i think you have to create a new function of "finding the nearest character" whenever the previous function is complete.

  • @angelmaetz
    @angelmaetz 4 роки тому +2

    so, how did they kill rick? There wasn't any touched event or anything-

  • @nikothegamer9895
    @nikothegamer9895 4 роки тому +2

    23:20 rick astley has been killed. Person who liked to rick roll.

  • @CorruptedDioSan
    @CorruptedDioSan Рік тому +2

    If your NPC is having a stroke when you're trying to make him go to random positions then do this:
    zombieHuman:MoveTo(zombieTorso.Position + Vector3.new(math.random(-50, 50), 0, math.random(-50, 50)))
    zombieHuman.MoveToFinished:wait()
    It'll walk to the position and wait the lowest value

  • @irezan
    @irezan 4 роки тому +1

    why did i get "Argument 1 missing or nil" on the for in loops line idk what it means pls help

  • @jamboo8329
    @jamboo8329 3 роки тому +2

    19:47 -- am I the only one who notices that

  • @Hexaltra
    @Hexaltra 5 років тому +2

    I was asking for vid on how to make a player warp a distance in where it's facing and now I feel stupid

  • @eyeofazurewrathe
    @eyeofazurewrathe 4 роки тому +2

    Time to try a moving noc

  • @MattAttacks
    @MattAttacks 2 роки тому

    there's this stage i am building for an obby game, in which players must move unanchored object onto a green plate which unlocks doors to pass thru. now the real question is do i have to use Magnitude and min/max distance variables like script shown in the video for this stage to work? this question is for everybody reading the comment section, would appreciate help.

    • @codebasic9664
      @codebasic9664 2 роки тому

      No

    • @guaroontheracoon
      @guaroontheracoon 2 роки тому

      i know that u probably finished the game at this point, but if u didnt
      u can just use Touch Functions, alot more simple and easy

  • @tacticalspatula6349
    @tacticalspatula6349 4 роки тому +1

    Could I do that zombie script with a normal part? Do I have to put a humanoid in it?

  • @nvermr
    @nvermr 2 роки тому

    i am going to make a useful module with this

  • @Majin_Trunky
    @Majin_Trunky 3 роки тому +2

    0:29 You Couldn't get this from any other guy

  • @dicelia
    @dicelia 4 роки тому +2

    I just got RickRolled by trying to learn script...

  • @saudiphilippines
    @saudiphilippines 3 роки тому

    You almost dropped the F-Bomb!
    Not shaming or hating you for it.

  • @iamsam9183
    @iamsam9183 4 роки тому +1

    how can you call the HumanoidRootPart from a character so i can move it to where if you clock something it can teleport you????

  • @carstencollins3340
    @carstencollins3340 4 роки тому +1

    What was the noise I wonder :thinking:
    I think I found it out, it was a chair squeaking noise I believe

  • @Laugh_out_loud_hahah
    @Laugh_out_loud_hahah 8 місяців тому +3

    implemented path finding:
    local pathfinding = game:GetService("PathfindingService")
    local allworkspace = game.Workspace:GetChildren()
    local btorso = script.Parent.Torso
    local bhuman = script.Parent.Humanoid
    local function findtarget()
    local argodistance = 50
    local target
    for i, v in pairs(allworkspace) do
    local human = v:FindFirstChild("Humanoid")
    local torso = v:FindFirstChild("Torso")

    if human and torso and v ~= script.Parent then
    --check distance
    if (btorso.Position - torso.Position).magnitude < argodistance then
    argodistance = (btorso.Position - torso.Position).magnitude
    target = torso
    end
    end
    end
    return target
    end
    local torso = findtarget()
    local path = pathfinding:CreatePath()
    path:ComputeAsync(btorso.Position, torso.Position)
    local waypoints = path:GetWaypoints()
    while wait(1) do
    if torso then
    local path = pathfinding:CreatePath()
    path:ComputeAsync(btorso.Position, torso.Position)
    local waypoints = path:GetWaypoints()
    for i, waypoint in pairs(waypoints) do
    local bal = Instance.new("Part")
    bal.Shape = "Ball"
    bal.Material = Enum.Material.Neon
    bal.Position = waypoint.Position + Vector3.new(0,2,0)
    bal.Size = Vector3.new(0.6, 0.6, 0.6)
    bal.Anchored = true
    bal.CanCollide = false
    bal.Parent = game.Workspace
    bhuman:MoveTo(waypoint.Position)
    bhuman.MoveToFinished:Wait(2)
    end
    else
    print("no torso")
    bhuman:MoveTo(btorso.Position + Vector3.new(math.random(-50,50), 0, math.random(-50,50)))
    wait(3)
    end
    end

  • @xkrystalbrookex
    @xkrystalbrookex 2 роки тому +1

    9:00 “Cause theres 6 partyparts”

  • @HUNGNGUYEN-hi8vr
    @HUNGNGUYEN-hi8vr Рік тому

    Oh yes magnitude this will work to measure how long will my car go

  • @sylvanusdzotsi7152
    @sylvanusdzotsi7152 3 роки тому +1

    For me, it finds the target but it doesnt move to it.Why?

  • @spacelol731
    @spacelol731 3 місяці тому

    I can't compare the Vector3 Value to the number value

  • @hazelsnep
    @hazelsnep 4 роки тому +8

    *random squeak* "oops sorry that was a bad noise"

  • @maliciouskevin
    @maliciouskevin 2 роки тому

    in 2022 the movements are super weird but tutorial was good

  • @over8087
    @over8087 4 роки тому +8

    --targets now take damage, pretty simple :)
    local zombieTorso = script.Parent.HumanoidRootPart
    local zombieHumanoid = script.Parent.Humanoid
    local function findTarget()
    local agroDistance = 100
    local hitDistance = 6
    local target = nil
    for _, v in pairs(game.Workspace:GetChildren()) do
    local human = v:FindFirstChild("Humanoid")
    local torso = v:FindFirstChild("HumanoidRootPart")
    local npc = v:FindFirstChild("ZombieNPC")
    if human and torso and v ~= npc then
    if (zombieTorso.Position - torso.Position).magnitude < agroDistance then
    agroDistance = (zombieTorso.Position - torso.Position).magnitude
    target = torso
    if (zombieTorso.Position - torso.Position).magnitude

    • @SaiRam-ht4mu
      @SaiRam-ht4mu 2 роки тому +2

      but the health depletes even when the npc does not touch u

  • @Michael-sg2ki
    @Michael-sg2ki Рік тому

    It does not work for me because roblox studio thinks position is a model.

  • @thespecificdev
    @thespecificdev 3 роки тому

    1:01 no more rick rolls 😭😭😭😭😭

  • @GU4RDIANBOSS
    @GU4RDIANBOSS Рік тому

    How do i make my model deal damage (I didnt use the model in the video)

  • @YeetoTheYeetafic
    @YeetoTheYeetafic 2 роки тому +1

    When you realise the TDK rickrolled you TWICE: 💀

  • @Chrisspeak13
    @Chrisspeak13 2 роки тому

    Wait I'm confused. Why did you had to do a while loop while you could just do local torso = findTarget()
    if torso then
    zombieHumanoid:MoveTo(torso
    .Position)

    • @Chrisspeak13
      @Chrisspeak13 2 роки тому

      Or wait(1) local torso = findTarget()
      if torso then
      ZombieHumanoid:MoveTo(torso.Position)

    • @rubenwiebe5816
      @rubenwiebe5816 2 роки тому +1

      If you didn't figure it out yourself yet it's so that every second the zombie will recheck its distance from the target and either redirect itself or stop chasing. Without the loop it would either walk straight to the nearest target without ever turning or just not detect anything in range and never move. It also needs it to wander around randomly. Hope that helps.

  • @SomeAverageYoutuber
    @SomeAverageYoutuber Рік тому

    Can I do this but with a delorean?

  • @Mcnikkins75
    @Mcnikkins75 3 роки тому

    0:35
    Cool my name is Rick too!
    Rick Mcnikkins

  • @captainbread5257
    @captainbread5257 2 роки тому

    In line 10, roblox dosent accept -= as "not equal to" and I dont know what I should use as replacement

    • @Nenutek
      @Nenutek 2 роки тому

      ~=

    • @child2601
      @child2601 2 роки тому

      make sure you are using the tilda ~ instead of minus sign like ~= instead of -=

  • @Captain_Snek
    @Captain_Snek 3 роки тому +3

    17:07 saving my time XD

  • @faizanahmad5042
    @faizanahmad5042 2 роки тому +1

    when you realize you've been ricked rolled

  • @toons8056
    @toons8056 2 роки тому

    Love it

  • @lemonsoupp
    @lemonsoupp 4 роки тому +3

    I feel sorry for Rick :(

  • @traz3989
    @traz3989 3 роки тому +1

    How would I make a script where people who're in the radius magnitude of 200 is damaged?

    • @RichRBLX
      @RichRBLX 3 роки тому

      i dont think thats anything to do with magnitude im pretty sure you check if the player is touching an invisible part or either set up a region3

  • @redhotsol7440
    @redhotsol7440 Рік тому

    how do you do in a certain range they die instantly

  • @semsemadel7585
    @semsemadel7585 Рік тому

    DEVTHEKING❤️‍🔥

  • @tazurd
    @tazurd Рік тому

    bro really rickrolled us

  • @duckboi8238
    @duckboi8238 4 роки тому +1

    The findtarget function didn't work for me so I used the function FindPeople()

  • @Imbrokeyay
    @Imbrokeyay Рік тому

    Corrected version i think: local PathfindingService = game:GetService("PathfindingService")
    local humanoid = script.Parent:WaitForChild("Humanoid")
    local humanoidRootPart = script.Parent:WaitForChild("HumanoidRootPart")
    local path = PathfindingService:CreatePath()
    path:ComputeAsync(humanoidRootPart.Position, game.Workspace.Part.Position)
    local waypoints = path:GetWaypoints()
    for i, 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()
    end
    humanoid:MoveTo(game.Workspace.Part.Position)

  • @360sauce7
    @360sauce7 2 роки тому

    What's the sense of Pathfinding if we have this?

    • @Nutsaq2222
      @Nutsaq2222 2 роки тому

      pretty sure if u hide behind a wall while the zombie is chasing you it would just walk into the wall, because you're only using the "humanoid:moveto" function. You could add custom waypoints but pathfinding is just better.

    • @challru5418
      @challru5418 2 роки тому

      magnitude is used for hitboxes for some games

  • @ferret9263
    @ferret9263 2 роки тому

    How do you make a stud counter using magnitude???

  • @prinaryprofit6635
    @prinaryprofit6635 4 роки тому +2

    It did not work for me at all :(