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

How would I make it so when a player joins, the camera detects when I am looking at them?

Asked by 3 years ago

When a player joins I want the camera to detect when I look away from the character and when I am looking at the character.

local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera

RunService.RenderStepped:Connect(function() 
    local point = -- I don't know what to put here since idk how to get the player
    local offset, onScreen = Camera:WorldToScreenPoint(point)
    if onScreen then
        game.ReplicatedStorage.LookAway.Value = false
        print("Looking away")
    else
        game.ReplicatedStorage.LookAway.Value = true
        print("Looking at character")
    end
end)
0
That's a really good question! I have no idea though. I'm sure someone really advanced in Lua will come in and help you. Voltaicmimic 43 — 3y

Answer this question