Help with raycasting (Unable to cast instance to Vector3)

I am working on my slender man Roblox game (yes, still, believe it or not) and i am trying to get raycast stuff working to trigger a GUI when slender man is being looked at.

However, whenever I test, it gives me the same output error: “Unable to cast instance to Vector3”
I have been trying to fix this, but I cannot get any ideas as to what it could be. Here is the script (or, well, a part of it):

while wait() do

local mag;

local range = game.Lighting.FogEnd - 2;

local cansee = true

local DummyHead = workspace.Slenderman["Meshes/thehead"]

	while wait() do
		mag = (c.Torso.Position - DummyHead.Position).magnitude;

local WG = workspace.Slenderman

	while wait() do
		local Position, CanSee = camera:WorldToScreenPoint(workspace.Slenderman["Meshes/thehead"])
		if CanSee and mag <= range and cansee then 

any help is appreciated, thank you in advance


I believe this is the error? You should add “.Position” after the brackets:

1 Like

i am so dumb :sweat_smile:
thank you for the help regardless! :slight_smile:

1 Like