Help with raycast

How would i use raycast to return the information of the part that is infront of me. any help would be appreciated

Just use a print?
Seems simple enough.

local Raycast = workspace:Raycast(...)
if not Raycast then return end --If Raycast returned nil, return.
print("Part Name: "..Raycast.Instance.Name.." | Part Material: "..Raycast.Instance.Material.Name)

You can add whatever you want to the print as long as you concatenate it to the string and it is capable of being turned into a string.
For example; Vectors are not able to be simply concatenated to a string, you have to give it the components.
print(Vector) => error
print(Vector.X, Vector.Y, Vector.Z) => X,Y,Z

1 Like

You can use the LookVector of the Players Character, and then Multiply it, for the Direction.

1 Like

thank you i have never used raycast so this is helpful