I'm attempting to activate a function when a player's head is facing a certain object.
I've tried using
(Humanoid.MoveDirection:Dot(workspace.CurrentCamera.CFrame.RightVector) <= 0.25)
but it turns out that it activates when a player isn't moving much to the right.
you can make the game first person and then if player's mouse is touching them execute the event or do something
you can do it like that
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() if mouse.Target == "The Object" then print("put anything here") end
local _, withinScreenBounds = Camera:WorldToScreenPoint(part.Position) if withinScreenBounds then -- We have successfully detected if the player can see the part. end
not sure I understood your question correctly but this should help you.