Tutorial: "Raycasting: Making a Laser Gun" tiny syntax error in code

At some point this line of code is explained:

local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - toolHandle.CFrame.p).unit * 300)

Problem is, toolHandle is not a variable. Later the same line of code is written as tool.Handle, which works.

Link: Documentation - Roblox Creator Hub

5 Likes

I’d just like to add to this, CFrame.p is deprecated (from what I know) and is superseded by CFrame.Position which looks a whole lot more cleaner and easier to read.

2 Likes

This entire article seems to be outdated because it mentions FormFactorPart.FormFactor which was deprecated in 2015 and doesn’t do anything anymore.

edit: it also uses .unit and .magnitude which were deprecated and replaced with .Unit and .Magnitude

2 Likes

Hi all,
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.

IgnisRBX

1 Like