edit; just realised megathread was a thing
The tutorial Raycasting: Making a Laser Gun doesn’t disconnect the
Mouse.Button1Down event listener, which could result in memory leaks and other potentially unexpected behaviour, mainly it will spam print the more you unequip and equip, as it’s creating new connections each time.
Also it uses deprecated terms:
CFrame.new(pos, lookAt) constructor
And finally, it is not compatible with filtering enabled as everything is done locally.
I dislike this entire article. It doesn’t accurately mention how to raycast at all and is the only official tutorial for it.
This article was migrated from the wiki a long time ago, which is why it is so incredibly dated. In fact, I think I remember this being written when raycasting first came out. We will either be removing it or updating it shortly after the team decides if it’s worth keeping around (there are more useful applications of raycasting).
The old article has been totally removed due to inaccuracy and outdated practices. It has been replaced with a new “Intro to Raycasting” article and a small demo place which you can experiment with.
Hope this helps! We’ll also be exploring more advanced topics/usages of raycasting in the future, but this intro was the first priority.
Well then! May that article rest in peace.
Worth noting that I just updated this article (and the sample project) to use the newer WorldRoot:Raycast() function instead of Ray.new() and workspace:FindPartOnRay(). I recommend developers begin migrating over to the newer API, as it’s easier to use and returns an object that can be more easily dissected.
Ooh nice. Will the old raycasting API be left as legacy or even deprecated?
man that article was really useful to me when i was a newer scripter, since i had no idea about how much outdated practices and code it had
though it was for the best i guess. rest in peace
Thankfully! Honestly the old tutorial was easy to understand for beginners (like me in a year ago) to create basic guns but it’s lack of explanations. However without this updated version, I don’t even know the RaycastParams exists!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.