I found this raycasting script in the sandbox and am interested on how it works; I know very little about raycasting and have attempted to learn, but it has been difficult. an explanation would be appreciated
local Ray = {
Cast = function(Cframe,Max)
local I = script.Parent
local LastS = 1
local Time = 0
repeat I:Resize(“Front”,1) Time += 1 until I.Size.z <= LastS or Time >= Max
return {Hit = I.Position+I.Size.z/2*I.CFrame.lookVector, Length = I.Size.z}
end
}
local digital = Ray.Cast(script.Parent.CFrame+script.Parent.CFrame.lookVector*5,50).Hit