Learn Raycasting in 7 minutes - Advanced Roblox Scripting
HTML-код
- Опубликовано: 7 авг 2024
- MERCH ► shop.gnome.codes/
DISCORD ► / discord
TWITCH ► / gnomecode
TWITTER ► / gnomecoderblx
WEBSITE ► gnome.codes/
TIMESTAMPS ►
0:00 Intro
0:32 Simple raycasts
3:00 Altering the hit part
3:41 Filtering results
5:25 Looping
6:47 Outro
just realized with this i can make pizza tower's "dont make a sound" mechanic. this is going to be so cool
Can you explain this more if sounds like an interesting concept
@@pe_wI think depending on the distance they won't make a sound
@@pe_wIn the Level they are Patrollers going around and if you get spotted, they count down from 5, giving you time to kill them and if it hits 0 then a Animatronic will start chasing you.
You don't need raycasting to do that. You can just use .magnitude to see the distance between the positions of their root parts.
BRO thank you so much! i am glad i found you because the first thing you said was "how to check if part can see another part" and this is exactly what i was searching for!
Thanks! A lot more simple than i thought! You are very underrated.
For "While True" loops, instead of having to put a delay at the end of the loop, you can do
While wait() do
-- Code here
end
It's actually more efficient to use task.wait(), because wait is deprecated
putting task.wait inside of while true do is better than putting while task.wait
Excellent tutorial. I’ve been working on raycasting in my game and have been unfamiliar with how the ray is being generated/set. This vid answers a lot of questions. Ty.
Nice explained and simple, now I can make stuff like you have to move a part until it sees the other part to open a door!
Whitelist and Blacklist are deprecated, you have to use Include and Exclude respectively, good luck with coding everyone
Yea it's annoying, I think that's very recent because I remember only a few months ago going onto my game and seeing a red underline on all the "Blacklists" so I had to change like 20+ scripts to "Exclude"
@@insertusernamehere8125You can just use the replace world feature to replace everything :/
Ty
yoo thank you man i was trying to figure out why it wouldnt work!
why do those freaks keep doing that
Thank you. I have been really confused with raycasting. Now I fully understand how it works. Thanks GnomeCode!
Great tutorial gnomecode! I love seeings these kinds of tutorials. I watch these while waiting for doors part 8. Good stuff.
The perfect video! Haven't watch it whole yet, but surely it will be good! :)
thank you so much for this man. i cant describe in words how thankful i am
Thank you most tutorials are outdated or confusing this helped alot
hi, thanks for the new amazing video! I'm sure it will come in handy for many!
thank You So Much For Making This Video, this is very Helpful For Me Because Im Making A Battleship Tower On My Td Game And I had A Small Turret Which I Want It To Shoot if It Detect The Target And I Didn't Know Anything About raycasting until now, thx for making this video
Thanks man! I'm using this like The Mad Murderer 2 in where the gun has a big line instead of a gradually increasing bullet.
I agree with others, this seems to be a good tutorial! I've heard that Roblox has added "shape-casts" sometime recently, though. I wonder how those work compared to raycasts, which are just drawing a line from a position in a specific direction.
i learn more about Raycasting cuz of that video thank you.
This is literally so helpful thanks
damn bro thank u for creating this i literally wanted this right now lol
nooo! i wanted to see the ball at the end fall into the void! D:
great tutorial though! can't wait to see more!
you can also calculate direction at workspace:Raycast() part using CFrame:LookAt()
Thank you so much Gnome.
Pretty good video, honestly very useful for paintballing games or whatever, but I need something important, How do I make the animate 2 script compatible with other scripts that load other animations?
you made this so much more simple
I was hoping the ball would turn yellow at the last second haha... anyways
great informative video! thanks!
Even though the title confused me, instead... The title should be *How To Make Line Of Sight* but this is really helpful because i need to make line of sight!
remember the reason there is no need for ~= nil in the if statement is because (in lower-level languages) the condition syntax secretly has a `identifier == 1` which 1 meaning true saying the identifier does exist. If you use the `NOT` keyword or `!` operator then it's opposite (0). All of this happens behind the language interpreter
Thanks for the epic video! When will we get a doors tutorial? Just saying :)
good video, we need pathfinding tutorial next
With this you can also do the doctor who angel mechanic for a horror game, interesting
WHEN IS THE NEXT GNOMEJAM!!! IM SO EXCITEDDD
Can't wait lol, I'm always so confused by Ray casting
Thank you gnome for this advice. Just to be clear I've been watching since 1k subs seeing you grow this far in a year is impressive for me. Thank you for always being here for us!
Thanks for sticking around :)
@@GnomeCodehey could you continue with your doors tutorials? Maybe ambush or cruzifix
I can make my horror game more realistic now! Thank you! :D
Hey Gnome! I have been watching your videos for a while now, since they are the only ones that actually teach me lol. I wanted to ask you to do a simple Object Oriented Programming guide for roblox studio. Apparently, it's a way to make your code more organized and efficient, some people say it's really important
Yes, we need an OOP series
Hey can you make a video on how to make a monster like doors like you made last time but can you make it use raycasting so it kills you when the monster sees you like ambush? Also keep up the great work it helps alot!
Useful thank you
GnomeCode I love your tutorial videos and I like them can you do a leaderboard
Wonder what part 8 of doors tutorials could be?! I was also wondering if you could show me how to make other hiding spots like beds or specifically for my map, an elevator!
a bed hide mechanic would be kinda useless because it’s basically just the locker but with changed animations
elevator would be something like using tweenservice
It helped me a lot when making scp 096 :)
Thanks! i might try making AI visibility, with ray cast
BROOP FINALLLYYYYY
Yes I love to be early to this GnomeCode video
This is incredibly helpful, but the only problem is it's the position of the part, and not the surface of it. So sometimes you're left with this awkward situation where you'd think it would be able to see the target part if it was the edge of another part at a different Y position, but it can't since the position of the part is at the centre, rather than the closest point of it, relative to the search part.
You can easily modify it so that the origin is on the surface on the part, just do simple math.
I want to know that "simple" math, when he said about calculate surface i remembe vietnam moments, aint no way soneone calculate so many possible points like volumetric sound
I can finally script Eyes!
you can use the raycast to make Rush's (optionally Ambush's) AI in your Doors tutorial, right?
I remember first starting Roblox Studio and remembering "I'm going to need to learn Ray Cast" and I struggled so much, but thanks to this amazing and short video I fully understand the basics of Ray Cast. I want to say thank you 😁
i'm a legend i liked and it turned to 700 woah great vid
Nice video
Thanks, this really helped alot with my understanding of raycasting! Appreciate it, keep it up!
Could u tell me how to raycast the object to the player?
i can raycast now thank you
Thanks man I needed to learn this for my entities (rush and ambush)
trust me raycast jumpscares are no easy bro
@@jakejat2 I just tried it and it's is NOT easy. What happened was it only kills the player in a certain range. That range isn't big enough, it's like lookvector. Only if rush's part is facing towards the player. Then it will kill the player
@@nightlure-SAPPHIRE hmm thats seems like a problem with your raycasting script
learned a while ago how to properly use it, and now I can use raycast
Epic tutorial! Could you possibly show how to make something simular to SCP-096?
how exatcly would this work on legs though if you want the legs to move up when its on a higher elevation but not go literally above the waist/core?
Thankyou
Hey Gnome. Would you do a gamenight on christmas?
With some more knowledge of what I wanna do. I could probably make a vehicle “antigravity” system. Like in Mario Kart 8. When the car is stopped upside down it doesn’t fall off!
now i realise that projectiles just are too complicated for me im happy that i finnally understand cframe and raycasting in a simple but effective way
Hey, I have a personnel question - what keyboard do you use?
i'm trying to make a web swinging system with raycasts, and i'm kinda stuck on the raycast direction part
GnomeCode, can you make a tutorial on how to make a inverse kinematics spider that can move around?
W tutorial!
Quick question.Can you remake your 2d plat-former tutorial.I think your last one is a little outdated.Thank you!
be careful y'all. app, the blacklist function has been deprecated and replaced with another one called "exclude", which does basically the same
So going back to AI could put raycasting inside of the killing AI? (Making it so every time the AI see`s you it gives a good chase...)
Blacklist and whitelist have been depreciated and replaced with include and exclude. They work functionally the same though
What if i want a range for a ray tho? Like this ray goes to the other side of the planet and if i want to detect something near 50 studs for example i cant do that like that can i? it would be epic if you record and part 2 or Full guide to raycast
u should make a video about the group copying your games
Could you make a real time strategy tutorial please? I want to make one but don’t know how
when i do the filter thing it says: member 'Blacklist' is deprecated
why there's no video How To Destroy Block On Look Roblox Studio
You should make a video on how to make a War game!
Gnome is scary I was looking for a Raycast tutorial (I haven't made a game with Raycasting in a Year) and then this
Nice
Hey GnomeCode! I'm a beginner scripter and currently following your TD series. Of course, I'm adding my own features using what I learned from your tutorials.
Everything's going well till I try to add a Gun Trail feature. I've tried twice but failed, is there something I'm missing on?
i dont have problems with the gun rail part. i have problems with the distance measuring.
I'm just going to assume that by that you mean you want a trail for the bullet. If you want that, then add a trail in the bullet and set the properties, and you should be good. If you are using a script that makes the bullet through the script, then add something similar to this to the script:
local trail = Instance.new("trail")
trail.Parent = bullet
trail.lifespan = (whatever you want)
(add some more properties)
Instead of 'Blacklist', use Exclude, As Blacklist is now depricated.
How can i make a gun using raycasting, can u make a video about it?
It's been a month... hope the next video comes out soon!
Hiya! I am making a game but I need an NPC to be able to walk on walls - i can only find tutorials on it for the player and I can't figure out what I needed!
2:48 I thought that an error pops up when you reference 2 parts have the same name that are both located in the workspace.
btw im pretty sure roblox removed black list or sum so you gotta use exclude now
Hi gnome I wanted to make a tower defense game but the tutorial is now outdated, Can you please remake it?
for what is the minus at direction 2:30
you are the griffpatch of roblox
bro i was having a mental break down for 2 hours, reached out to 2 forums and ai bots for it to be that for direction you dont use unit and its also reversed...
Simple,Straightforward,Yet explains very well
thank you gnoemcode for this tutorial
this is helpful, but how to make it detect players?
3 more hours to be save of this fire
What's dat studio font :))
When I open my script I can't find it it it's separated from workspace
A bit late but i have qestion to tower defense tutorial. You are showing how to do only one path ubgrades but I wanted to make 2 paths of ubgrades like in BTD5. Is there a way of doing that?
That script would be too advanced, so unless you have someone who knows lua well, it won't be possible.
Hey Gnomecode, i was thinking if you could maybe do a gnomejam again i would realy like that cause im a begginner developer and i would learn a lot from the gnomejam.
Tip : you don’t have to cut and paste lines of code, you can just select it and drag it to your desired position
nah, its faster to copy and paste because if you drag it it messes up the format and you have to do extra steps to format the code
Yiu can actually "move" the block of code by holding alt and pressing the arrows too!
@@kennethkline7702 really?!
@@epixerty true but you may have something important in your clipboard
@@fexryourfriend I use both, because youre right here, but i find copy and pasting more convenient most of the times
how to make it transparent????????????
Rest in peace red ball you will be missed 😔
Blacklist and Whitelist are deprecated now, make sure you use Include and Exclude instead!
POV: you see a GnomeCode video from 12 minutes ago AND It's about something that always confused you
Day 2 on asking: Can you please show how to make a pokemon game? I came up with my own pokemon, but I don't understand how to make games.. I don't understand the Scripting well so that's why I use RUclips to help me!
Can someone tell me the scripts so i can copy and paste them?