The ONLY Raycasting Tutorial You'll EVER NEED

Поделиться
HTML-код
  • Опубликовано: 2 янв 2024
  • In this video, I take you on an adventure, where we master Roblox Raycasting using lasers and, yes, monkeys!
    What You'll Learn:
    The Basics of Roblox Raycasting
    Creating and Scripting Lasers in Roblox
    Adding Playful Monkeys to Your Game
    Tips & Tricks for Efficient Scripting
    Why Roblox Raycasting?
    Raycasting in Roblox is a powerful tool that can bring your games to life. Whether it's creating laser beams, designing intricate game mechanics, or simply adding a touch of fun with monkeys, understanding raycasting is key. This tutorial is perfect for beginners and those looking to brush up on their skills.
    Get the Beginner's Guide to Roblox Scripting book here: linktr.ee/scri...
    Here's the tutorial on Shapecasting: devforum.roblo...

Комментарии • 128

  • @scripting
    @scripting  5 дней назад +2

    If you liked this video, you'll love some high quality Roblox scripts for your game. Check out scriptsstudios.com

  • @scripting
    @scripting  4 месяца назад +32

    Quick story about this video...
    I had gotten my Roblox account banned 2 weeks before this video was conceptualized. That meant I had 0 robux. I hadn't edited my own videos for 5 years, and I really wanted to help a lot of you with raycasting, so over 2 months straight, I learned editing and edited about half of this video before I had enough robux to send it to the actual editor to finish off.
    I conceptualized this video when I was sick with COVID-19. In bed, with a fever and all, I was thinking of a story to help you learn raycasting, which is the story you see. It took hours upon hours to make this video possible, and we will definitely have more of these masterpieces. I wanna make the best Roblox scripting videos to help you learn, and this is definitely one of them.
    Thank you so much for watching, and I really hope it helped you.
    If you wanna support the channel, all you have to do is subscribe.
    If you wanna support even further, I wrote a book on Roblox scripting and I teach it privately in a paid discord membership, which you can check out here: linktr.ee/script_ing
    Once again, thanks for watching and see you next time!

    • @zuyathegreat
      @zuyathegreat 4 месяца назад +2

      ur helping me sm bro, ty for teaching us scripting, i can finally obliterate monkeys on a trampoline now :D (jokes aside, best content on yt)

    • @scripting
      @scripting  4 месяца назад +4

      @zuyathegreat 🔫🐒

    • @BestRBX
      @BestRBX 3 месяца назад +2

      hey can you help me with my game: i am trying to make it so that you cant damage teamates and im trying to make kills and deaths leaderstats but i dont know how @scripting

    • @mxdagamedev
      @mxdagamedev 23 дня назад +1

      best raycasting vid u ever made

  • @Aropiction
    @Aropiction 9 дней назад +2

    Well I don't speak English very well, so I'm screwed, but finally a young person who knows how to make tutorials! This way of learning, here is a real tutorial and not just a presentation of a script

  • @CallMe_Noah
    @CallMe_Noah 3 месяца назад +3

    how is this so underrated yet the edit is absolutely amazing and the teaching finally actually teached me the most of raycasting, you deserve a million subs dude

  • @davidnatanael8542
    @davidnatanael8542 7 месяцев назад +13

    This video explain raycasting very well, good job!
    (i hope you get popular)

    • @scripting
      @scripting  7 месяцев назад +4

      Thank you so much!

  • @rolpon2871
    @rolpon2871 Месяц назад +2

    This is such a good raycasting tutorial!!!!! I could 100% see a new roblox scripter easily learning how raycasting works with this video. Great job using animations to explain how raycasting works!

  • @maxcamp6
    @maxcamp6 8 дней назад

    this is genuinely the best scripting tutorial ive seen on youtube, i hope you gain more traction because this is criminally underrated.

  • @anwyllaquilla4724
    @anwyllaquilla4724 2 месяца назад +4

    This is sooo digestable not just mindless ramblings on 30 lines of codes
    I hopw that you get the attention and subscribers you deserve

    • @vicentegodoy3783
      @vicentegodoy3783 День назад

      yeah, i love these type of videos that are so well made

  • @relix3267
    @relix3267 5 месяцев назад +9

    Damn this is a good video you explained everything so well! I really hope you make it as a big youtuber cause I believe you have a ton of potential.

  • @TheBananaDogeGod
    @TheBananaDogeGod 3 дня назад

    Wow that was probably the best roblox tutorial I've ever seen. Super high quality 👍

  • @lucasbarker9075
    @lucasbarker9075 7 месяцев назад +17

    I’m not making a game,I’m just watching this for entertainment

  • @Lovely_Smiling
    @Lovely_Smiling 3 месяца назад +3

    I wish I've find you sooner your video is very helpful and made with efforts! I've been struggling trying to learn raycasting for a while and this video help me out a lot you deserve more subscriber 💖

  • @snakeanimations9025
    @snakeanimations9025 4 дня назад

    Most entertaining tutorial I've ever watched lol. Great vid. :)

  • @weirdguylol
    @weirdguylol 7 месяцев назад +3

    This is easily one of the best tutorials ever made

  • @mrva1k
    @mrva1k 3 месяца назад +1

    This is one of the best tutorials on ray casting I have came across on RUclips (along with ByteBlox’s)! I am looking forward to more uploads from you :)

  • @jonnyponnyyy
    @jonnyponnyyy 7 месяцев назад +4

    Interesting and Entertaining Video Lesson!
    Perfectly balanced as all things should be.

  • @Pabliski577
    @Pabliski577 6 месяцев назад +3

    It's a shame that mostly coders will watch this and not more people, because it's a fantastic video

    • @scripting
      @scripting  6 месяцев назад

      It is. Thanks!

  • @ImTalkative
    @ImTalkative 7 месяцев назад +4

    Yet another useful video. Thankyou!

    • @scripting
      @scripting  7 месяцев назад +1

      Anytime for you guys

  • @mathiashansen2424
    @mathiashansen2424 Месяц назад

    Very good tutorial. The only thing i need to know now is how people make it so when you shoot a gun with raycasting. It will leave a trail so it looks like it is a kind of bullet, a lot of games have this :D

    • @scripting
      @scripting  Месяц назад +1

      You can make a bullet and use ApplyImpulse on it to make it fire

  • @RandomDev_RGB
    @RandomDev_RGB 6 месяцев назад +1

    This Tutorial Helped me Alot, Before watching this, i didn't even know What raycasting Is, Now i do. Thanks!

  • @KashTheKingYT
    @KashTheKingYT 6 месяцев назад +1

    Very nice tutorial and editing!
    I will be recommending this video to anyone asking me about raycasting

  • @gunsizey
    @gunsizey 12 дней назад

    real lifesaver, keep up the good stuff bro

  • @fireakahatred1396
    @fireakahatred1396 7 месяцев назад +3

    nah no way, this video only have 7 comments and 20 likes, this video is so well made and yet so underrated

    • @scripting
      @scripting  7 месяцев назад

      Took 2 months to make this video 😅

  • @AntiNuke_
    @AntiNuke_ 6 месяцев назад +1

    Thank you for the car analogy to explain the normal of an object, I was literally thinking "what practical use does this have".

    • @scripting
      @scripting  6 месяцев назад

      Yup. It’s used everywhere, especially in places where we would never even think of.
      When a gun is firing, we fire a ray where the origin is the gun and the direction is where our mouse points (just like in the video)
      When you select a troop in a tower defense game (or in my game, battle mania), a Raycast is done from the foot to the ground so the script knows where the ground is and to place the troop effectively

    • @AntiNuke_
      @AntiNuke_ 6 месяцев назад

      I was talking specifically about the "Normal" of the raycast. I know raycasts are used for basically everything, super useful tool. But before now I had no clue what the normal of a raycast instance was, and during the video I was wondering when anyone would ever use it.@@scripting

    • @scripting
      @scripting  6 месяцев назад

      @@AntiNuke_ Gotcha. Yeah, the normal is used like in the footsteps example, and perhaps also making a thrown object ricochet off surfaces it hits.
      For example, a ball is thrown. It hits a wall. Apply a lesser force on that ball with the direction of the normal of the surface. Repeat.
      If you do this to a laser, it can give a laser bouncing off / ricochet effect

    • @AntiNuke_
      @AntiNuke_ 6 месяцев назад

      Yep, I just actually used the normal of an object to make a script that makes the camera bounce off an object it hits using a raycast from the head to the camera position detecting what the camera is hitting.@@scripting

  • @HimJustHim.
    @HimJustHim. 5 месяцев назад +1

    ngl , this video is both entertaining and easy to understand , im looking forward to the shapecast video

    • @scripting
      @scripting  5 месяцев назад

      Glad you enjoyed it!

  • @HullyDoesCoding
    @HullyDoesCoding 5 месяцев назад +1

    Ur teaching is so underrated ong. U deserve more subscribers

  • @Riptcage
    @Riptcage 5 месяцев назад +3

    While the video does great at explaining how raycasts work... the main raycasting of the gun is all happening on the client, which doesn't really work well in a multiplayer environment.

    • @scripting
      @scripting  5 месяцев назад +1

      It doesn’t, you’re right. But for games with small servers or small Raycasts / second, it’s totally fine. In my experience, even 20-40 Raycasts per second works fine

  • @s1nblitz
    @s1nblitz Месяц назад

    thanks broski, i spent SO LONG wondering why my raycast gun didnt work for some reason. seems like the multiply by 500 thing was all i needed

  • @otterryy
    @otterryy 6 месяцев назад +1

    very good explanations would look to see more videos like this but chill on the sfx and tv glitch

  • @mrenots5489
    @mrenots5489 2 месяца назад

    Wish i saw this sooner, i've been trying to learn about raycasting for a while now.

  • @Just-a-commenting-account
    @Just-a-commenting-account 7 месяцев назад +1

    wow really helpfull straight to the point and explained so that it can be understood easily! Thank you! (Just got a new sub)

  • @edonpogi4
    @edonpogi4 Месяц назад

    Am only at halfway but like DAMN THIS IS AWESOME TUTORIAL

  • @darkbard7
    @darkbard7 5 месяцев назад +2

    Your so underated

  • @musembifamily1318
    @musembifamily1318 5 месяцев назад +1

    this is good good job and also can you make more vids on advanced stuff? pls like stuff that isnt taught yet bc most ppl say read the docs but i like hearing than reading

    • @scripting
      @scripting  5 месяцев назад

      Sure! What stuff do you wanna see?

    • @yt-user235
      @yt-user235 2 месяца назад

      @@scripting could you maybe explain the for stuff like "for i,v'

  • @HeyShattered
    @HeyShattered 4 месяца назад +3

    *i asked my mom to buy me your book as my birthday gift

    • @scripting
      @scripting  4 месяца назад +2

      Happy birthday and thank you!🙏

    • @HeyShattered
      @HeyShattered 4 месяца назад +1

      @@scriptingyou're my favorite roblox studio youtuber :D

    • @HeyShattered
      @HeyShattered 4 месяца назад +1

      @@scriptinghey i followed the link and went on kindle but it says there's no more hard copies left 😭

    • @scripting
      @scripting  4 месяца назад +1

      @HeyShattered Check the Barnes and noble one

    • @scripting
      @scripting  4 месяца назад +1

      @HeyShattered www.barnesandnoble.com/w/unofficial-beginners-guide-to-roblox-scripting-kushal-timsina/1144181010

  • @juanbones
    @juanbones 16 дней назад +1

    Why does it say “ray origin” is not a valid member of part?

  • @Martin-ew3gy
    @Martin-ew3gy 5 месяцев назад +1

    I RARELY COMMENT BUT THIS IS SO WELL EXPLAINED,,, TYSM

  • @altas6067
    @altas6067 3 месяца назад +1

    followed the code and at the point around 5:30 instead of the raycast returning the values it returns nil

    • @scripting
      @scripting  3 месяца назад

      I believe it’s because for the Attachment.Position, it should have been Attachment.WorldPosition

  • @oleNikolic
    @oleNikolic 5 дней назад +1

    I have a question, how much did you Need to study(practice) scripting and other game aspecpts before being sure to make a big project like the ‘Battle Mania’. I am asking this because i currently have about 1year scripting knowledge, and i don’t really know to build on blender, make Vfxs and that stuff😅

    • @scripting
      @scripting  5 дней назад

      I’ve been scripting for 8 years. So, by the time I began battle mania, I already knew how to script anything I wanted lol. Keep on scripting though, script whatever you want to script and whatever is interesting, and you’ll get there.

    • @oleNikolic
      @oleNikolic 5 дней назад

      @@scriptingJust one more question, did you also build and did the vfx stuff for the Game or you Had someone(or a team) to build that stuff?

    • @scripting
      @scripting  5 дней назад +1

      @oleNikolic I work with a 3d modeler / animator. Everything else was made by myself

  • @SHOIOTERB
    @SHOIOTERB 4 месяца назад

    Thank you, now I know how to make a Part go to the position where you clicked and make it look at the part

  • @user-kj6kq9lp2l
    @user-kj6kq9lp2l 5 месяцев назад +1

    21 yo cs major and this is good quality education i hope to educate people one day in the future

    • @scripting
      @scripting  5 месяцев назад

      Thank you man. I’m 20 y/o cs major

  • @SAJOMENEZ
    @SAJOMENEZ 4 месяца назад

    REALLY WELL EXPLAINED!
    YOU ARE UNDER RATED

  • @ByteSpeeder
    @ByteSpeeder 9 дней назад

    time to take the script and redo it without learning anything-

  • @MagAgent006-qj5nm
    @MagAgent006-qj5nm 9 дней назад +1

    finally a good explain video for idiots like me

    • @scripting
      @scripting  9 дней назад +2

      I fully think that if you’re watching this video, you are not an idiot

  • @duhthunder9423
    @duhthunder9423 6 месяцев назад +1

    Underrated , keep it up

  • @lexicon_c
    @lexicon_c 5 месяцев назад +1

    hold on, at 7:34 ish, doesnt the roblox humanoid have a floormaterial property? couldnt you use that instead??

    • @scripting
      @scripting  5 месяцев назад

      You could, but this video was made before I found that property out. Behind the scenes however, roblox most likely uses Raycasting to deduce the floor material

    • @lexicon_c
      @lexicon_c 5 месяцев назад

      @@scripting ohh! okay

  • @ben4990
    @ben4990 2 месяца назад

    The top of my left eye enjoyed the first half

  • @user-uu8ol2ys1h
    @user-uu8ol2ys1h 5 месяцев назад +1

    this video explained raycasting very well. although why did you give it to ur little brother again?

    • @scripting
      @scripting  5 месяцев назад

      Thanks. The reason we gave it to the little brother is because it isn’t dangerous. It’s a toy! 😅

  • @rbu9_
    @rbu9_ 5 месяцев назад +1

    if u continue like this, u will be the biggest roblox devolper youtuber.

    • @scripting
      @scripting  5 месяцев назад

      Most definitely

  • @starilu
    @starilu 4 месяца назад +1

    is there a way to make the raycast like into a visible object like a laser or a bullet

    • @scripting
      @scripting  4 месяца назад

      You can. You’d make a part and set the CFrame to look where you want it to and the size.Z (or size.X) to the raycastResult.Distance

  • @brandontwist7608
    @brandontwist7608 7 месяцев назад +1

    I hope u go viral

    • @scripting
      @scripting  7 месяцев назад

      Thanks man. Soon enough!

  • @shexahi2823
    @shexahi2823 Месяц назад

    6:38 when i ran it i got an error
    "Players:GetNameFromUserIdAsync() failed: HTTP 429 (Too Many Requests)"
    anyone know the issue? this is the code
    local laser = script.Parent
    local getMouseRemote = game.ReplicatedStorage.getMouseRemote
    laser.Activated:Connect(function()
    local player = game.Players:WaitForChild(laser.Parent.Name)
    local rayorigin = laser.Handle.Rayorigin.Position
    local mouseposition = getMouseRemote:InvokeClient(player)
    local raydirection = (mouseposition - rayorigin).Unit * 400
    local raycastresult = workspace:Raycast(rayorigin, raydirection)
    if raycastresult then
    print(raycastresult.Instance)
    raycastresult.Instance:Destroy()
    end
    end)

  • @Official_SteamPUNKS
    @Official_SteamPUNKS 28 дней назад

    if anyone has any idea if this works, is there a way to make it so that I can have the ray fire off when I press space bar as oppose to having a weapon active? thanks!
    I should also mention I want the ray to originate from the Player

  • @scount999
    @scount999 4 месяца назад

    Best Raycasting guide out rn

    • @scripting
      @scripting  4 месяца назад

      You know it 💯

  • @Devthedev.
    @Devthedev. 4 месяца назад

    You are extremely underrated

  • @1KosovoJeSrbija1
    @1KosovoJeSrbija1 3 месяца назад +1

    the most important script is on screen for a total of two seconds 💀

    • @scripting
      @scripting  3 месяца назад +1

      Good thing there’s pause! 😂

  • @JyrenTempest
    @JyrenTempest 25 дней назад

    Amazing 😂

  • @Jamal.frl_13
    @Jamal.frl_13 3 месяца назад +1

    So how do you make a gun with projectiles with raycast?

    • @corbinwalton9996
      @corbinwalton9996 Месяц назад

      check if what it hits is a player by checking if its parent has a humanoid and then lower the humanoids health if there is one

    • @Jamal.frl_13
      @Jamal.frl_13 Месяц назад

      @@corbinwalton9996 I know how to do that, but I wanted to use raycast to make projectiles instead and if it would touch the character I would now lower the health.

  • @LegoPieces_
    @LegoPieces_ 3 месяца назад +2

    Is this inspired by Cary time traveler video.. 😱

    • @scripting
      @scripting  3 месяца назад

      Nope

    • @LegoPieces_
      @LegoPieces_ 3 месяца назад

      @@scripting Oh, because I thought of the baby reference.. they used. 🤔

    • @scripting
      @scripting  3 месяца назад

      @PurpleLegoPieces the baby picture was one I found from unsplash, a free stock image site

  • @brandontwist7608
    @brandontwist7608 7 месяцев назад +1

    Only 400 views bro 25 minutes of editing that must’ve taking hours. ❤

    • @scripting
      @scripting  7 месяцев назад

      It took 2 months of preparation. I’m not worried about the views. To me, I just wanna give back the best scripting lessons

  • @canialive
    @canialive Месяц назад

    loading 414GB of information... (watching vid)
    ...
    successfully loaded 414GB of information (415724112 GB left)
    cool vid! i hope u will get 83275329856352735265+ subscribers

  • @GeneralFrst
    @GeneralFrst 2 месяца назад

    Is it possible to make the raycast go through everything? Or i have to use somrthing else

    • @scripting
      @scripting  2 месяца назад +1

      Yes you can. The way it’s done is like this: fire a Raycast. From the Position of the Raycast Result, fire another one again in the same direction. And another. … and so on

    • @GeneralFrst
      @GeneralFrst 2 месяца назад

      ​@@scriptingthanks

  • @firebloox
    @firebloox 2 месяца назад

    LocalPlayer is not a valid member of "Players" wth

    • @scripting
      @scripting  2 месяца назад

      Use a local script

  • @rightisfun
    @rightisfun 4 месяца назад +1

    ur a g

    • @scripting
      @scripting  4 месяца назад +1

      ur a g for watching

  • @Fahej34214
    @Fahej34214 4 месяца назад

    Where do you create the mousepos script at 5:20?

    • @scripting
      @scripting  4 месяца назад

      I believe it’s a local script in starter gui

    • @Fahej34214
      @Fahej34214 4 месяца назад

      @@scripting when I put it there is says
      OnClickInvoke is not a valid member of RemoteFunction "ReplicatedStorage.GetMousePosition"

    • @Fahej34214
      @Fahej34214 4 месяца назад

      when I put it anywhere besides ServerScriptService it gives me an error but even when its there it doesnt work

    • @scripting
      @scripting  4 месяца назад

      So that’s because it shouldn’t be OnClickInvoke, it should be OnClientInvoke
      The reason it doesn’t give you an error when it’s in server script service is because local scripts cannot run there

    • @Fahej34214
      @Fahej34214 4 месяца назад

      @@scripting ohhh right im blind, sorry for wasting your time, thx for help

  • @sadge6430
    @sadge6430 4 месяца назад

    =po

  • @sadge6430
    @sadge6430 4 месяца назад

    yit

  • @sadge6430
    @sadge6430 4 месяца назад

    nbv