Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Raycasting from a brick not working?

local myRay = Ray.new(
               Vector3.new(script.Parent.Position),
               Vector3.new(48,20,20)
            )
local obj, endPoint = workspace:FindPartOnRay(myRay)
if obj then
    print("HIT!")
else
    -- nothing
end

Hi guys! I have this script in a brick and when I move it around near things it still does not print "HIT!" - any ideas why?

Thanks

1 answer

You need to check if it hit anything or if it didn't hit anything, or else the code will error

This discussion is preserved as it was. New answers, comments, and votes are closed.