local mouse = UserInputService:GetMouseLocation()
local unitRay = workspace.Camera:ScreenPointToRay(mouse.X, mouse.Y)
local rayResult = workspace:Raycast(unitRay.Origin, unitRay.Direction * 150)
It works really well, the ray touches precisely everything I click. The problem is that it doesn’t touch / detect my player… instead it touces whatever is in front of it.
I’m not very advanced in scripting as I’m practicing but, I think you need a line that let the Raycast know you’re looking for a player. That’s my understanding of scripts at the moment. Or it doesn’t work because the ray is coming from your player, you just need to detect when you send the Raycast off?
Huh, I totally forgot about the new raycasting system. I think by default, your character is ignored. Such as trying to place your mouse on the player and print the hit object. It will simple print the object behind the player as if you never existed.
Seen as i need to learn this new raycasting system, I cant help you. But I have an idea.
If you only want to interact with the character, this may work. But ive not tested yet.
If i come across anything, ill let you know. Good luck!
EDIT: Found out the ray system I used it deprecated. So try not to rely on it in new work.