Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would you check if the players camera is pointing at a certain part?

Hello! I'm making a survival game. In the first level, you are put in a crib as a child, and a feature I'm trying to add is if the players camera is pointing at a certain part, it will make the player become closer to the part, or standing up, rather. I've heard people ask similar questions, but the only answer I can get out of them is if the part is visible, and I'm looking for this part to be invisible. The only problem being is I have no idea where to start, because I've never had experience with something like this.

Although, if someone could get me a working answer, I can implement that into my brain and type it out next time. Thanks!

2 comments

0

is the person in 1st person?

0

yes

1 answer

✓ Accepted answer

use an if statement for Mouse.Target. You can get the players mouse by using the following script:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Move:Connect(function()
       --code.
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.