I want to make a game where players can place blocks. In order to do so I have to find the position that the mouse is pointing at. How can I do this? I was reading somewhere that I can do this using rays. Can someone also explain what are rays, and how are they used?
✓ ANSWER ACCEPTED
How to find the position that mouse is pointing at?
1 answer
✓ Accepted answer
The quickest way to do this would be just doing this in a localscript
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
while true do--showcasing purposes
print(mouse.Hit.Position)
wait()
end
mouse.Hit being a CFrame, and mouse.Hit.Position being the position component of that CFrame
This discussion is preserved as it was. New answers, comments, and votes are closed.
