WorldToScreenPoint - Head is not a valid member of Model Error - finding model

Hello! I try to make script that’ll find npc to make it stop when i look at it - but i get error while finding his position.
It reads:

Head is not a valid member of Model Error

same goes with HRP etc…
my script is:

local _, cameraBool

while true do
	task.wait()
	
	_, cameraBool = workspace.CurrentCamera:WorldToScreenPoint(workspace:WaitForChild("NPC").Head.Position)
	
	if cameraBool then
		print(tostring(game.Players.LocalPlayer.Name) .. " can see the npc")
	end
end	

just to clarify - i dont ask for script to make it stop - i ask to help me fight the error which matter i understand not.
please help

Is Head part of the NPC?, it could be lowercase.

Head is part of the NPC model, and everything is written good, like
image
i dont see what may be wrong about this code, and NPC model itself. just to clarify NPC is compeletly custom, but i think its not the cause.

Try this, I added some printing to give more information if anything went wrong.

local _, cameraBool

while true do
    task.wait()
    
    local npc = workspace:FindFirstChild("NPC")
    if npc and npc:IsA("Model") then
        local npcHead = npc:FindFirstChild("Head")
        if npcHead then
            _, cameraBool = workspace.CurrentCamera:WorldToScreenPoint(npcHead.Position)
        end
    else
        print("NPC not found in workspace")
    end
end


Script you sent looks like it might work but i think i messed up with output because i dont get even one line of code that should occur even tho i enabled everything to show up.
image
image

Also i put this as a localscript in the ReplicatedFirst, is it fine?

The local script should go in “StarterGui” as its messing with the camera aswell and should work the same.

Okay, i put it here and it’s replicated and from now on only one thing remains. I dont have error no more but also while i put your text into script i receive no callstack nor error message, which still hits me, idk maybe that studios fault that i dont receive any prints, its not the first or last time. I tried using prints to debug my code and it never did anything. Ill check if it works “in practice” and it probably does.

NEVERMIND! Im stupid i just realised that in your code there was no “positive output” and when i made it, it started working! Thanks for your effort, have a nice day!