-
What do you want to achieve?
I’m just doing some learning with raycasting for a project I plan on taking on and I’m just trying to learn how to detect hits and raycasting in general. What I’m trying to accomplish here is just simply printing info about the part the ray is hitting. -
What is the issue?
When I run the game my if statement returns that nothing was hit which is odd since the brick is in the path of the ray. -
What solutions have you tried so far?
I’m unfamiliar with raycasting so nothing yet other than doing some Google searching which turned up with nothing related to my
local rayOrigin = Vector3.new(-17.821, 5, 2.177)
local rayTarget = game.Workspace.hitPart.Position
local rayCastResult = workspace:Raycast(rayOrigin, rayTarget)
if rayCastResult then
print("Ray Hit!")
print(rayCastResult.Instance)
else
print("No target found!")
end