Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by
2_MMZ 1059 Moderation Voter
3 years ago

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!

0
is the person in 1st person? sne_123456 439 — 3y
0
yes 2_MMZ 1059 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

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)
Ad

Answer this question