Learn Raycasting in 7 minutes - Advanced Roblox Scripting
Вставка
- Опубліковано 8 чер 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.
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!
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.
Thank you. I have been really confused with raycasting. Now I fully understand how it works. Thanks GnomeCode!
Thank you most tutorials are outdated or confusing this helped alot
thank you so much for this man. i cant describe in words how thankful i am
The perfect video! Haven't watch it whole yet, but surely it will be good! :)
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
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
thanks dude! saved me 1 line of code-
It's actually more efficient to use task.wait(), because wait is deprecated
how DARE you use wait()
putting task.wait inside of while true do is better than putting while task.wait
Great tutorial gnomecode! I love seeings these kinds of tutorials. I watch these while waiting for doors part 8. Good stuff.
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
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.
With this you can also do the doctor who angel mechanic for a horror game, interesting
hi, thanks for the new amazing video! I'm sure it will come in handy for many!
you can also calculate direction at workspace:Raycast() part using CFrame:LookAt()
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
i learn more about Raycasting cuz of that video thank you.
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
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.
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?
This is literally so helpful thanks
you made this so much more simple
Thank you so much Gnome.
damn bro thank u for creating this i literally wanted this right now lol
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
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!
nooo! i wanted to see the ball at the end fall into the void! D:
great tutorial though! can't wait to see more!
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
Can't wait lol, I'm always so confused by Ray casting
I was hoping the ball would turn yellow at the last second haha... anyways
great informative video! thanks!
you can use the raycast to make Rush's (optionally Ambush's) AI in your Doors tutorial, right?
good video, we need pathfinding tutorial next
Thanks! i might try making AI visibility, with ray cast
Thanks for the epic video! When will we get a doors tutorial? Just saying :)
Could u tell me how to raycast the object to the player?
Yes I love to be early to this GnomeCode video
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
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
GnomeCode I love your tutorial videos and I like them can you do a leaderboard
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!
WHEN IS THE NEXT GNOMEJAM!!! IM SO EXCITEDDD
Hey Gnome. Would you do a gamenight on christmas?
It helped me a lot when making scp 096 :)
Hey, I have a personnel question - what keyboard do you use?
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?
i'm trying to make a web swinging system with raycasts, and i'm kinda stuck on the raycast direction part
Quick question.Can you remake your 2d plat-former tutorial.I think your last one is a little outdated.Thank you!
I can finally script Eyes!
GnomeCode, can you make a tutorial on how to make a inverse kinematics spider that can move around?
i'm a legend i liked and it turned to 700 woah great vid
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
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 😁
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...)
be careful y'all. app, the blacklist function has been deprecated and replaced with another one called "exclude", which does basically the same
why there's no video How To Destroy Block On Look Roblox Studio
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
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)
Blacklist and Whitelist are deprecated now, make sure you use Include and Exclude instead!
Useful thank you
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.
Blacklist and whitelist have been depreciated and replaced with include and exclude. They work functionally the same though
BROOP FINALLLYYYYY
Thanks, this really helped alot with my understanding of raycasting! Appreciate it, keep it up!
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!
when i do the filter thing it says: member 'Blacklist' is deprecated
Could you make a real time strategy tutorial please? I want to make one but don’t know how
Epic tutorial! Could you possibly show how to make something simular to SCP-096?
How can i make a gun using raycasting, can u make a video about it?
i can raycast now thank you
u should make a video about the group copying your games
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...
Thankyou
It's been a month... hope the next video comes out soon!
Hi gnome I wanted to make a tower defense game but the tutorial is now outdated, Can you please remake it?
When I open my script I can't find it it it's separated from workspace
this tutorial is excellent but does (Params.FilterType = Enum.RaycastFilterType.Blacklist) not work for anyone else
btw im pretty sure roblox removed black list or sum so you gotta use exclude now
You should make a video on how to make a War game!
Nice video
Simple,Straightforward,Yet explains very well
thank you gnoemcode for this tutorial
this is helpful, but how to make it detect players?
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.
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
Nice
Gnome is scary I was looking for a Raycast tutorial (I haven't made a game with Raycasting in a Year) and then this
Can someone tell me the scripts so i can copy and paste them?
W tutorial!
What's dat studio font :))
Rest in peace red ball you will be missed 😔
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.
3 more hours to be save of this fire
you are the griffpatch of roblox
When is the next Doors vid?
POV: you see a GnomeCode video from 12 minutes ago AND It's about something that always confused you
when the doors series videos? i miss them :(
I will continue the series in the new year, I'm on Christmas break right now :)
Doom is not done alone
Blacklist is deprecated now. Is it alright to keep using it?
Blacklist was replaced by 'Exclude' I think
hello there can you teach me how to make a game like clash royale in roblox please