Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't WorldToScreenPoint working at all?

Hey! I've figured out my last question, and I've tried worldtoscreenpoint, but however, if the player looks at the part, is does nothing at all. I've never worked with WorldToScreenPointbefore, and I'm new to it. Can someone tell me what's wrong? I've tried this in both a script and localscript, workspace and startergui. Any working answer is appreciated.

local camera = game.Workspace.CurrentCamera
local part = game.Workspace.lookatpart
local _, withinScreenBounds = camera:WorldToScreenPoint(part.Position)

if withinScreenBounds then
   print("Player looking at object has been detected.")
end

1 comment

0

You could use dot products, I'd go for that solution. I've used worldtoscreenpoint before however I've forgotten how to use it, sorry.

1 answer

✓ Accepted answer

Look up a tutorial for this, it could help you.

This discussion is preserved as it was. New answers, comments, and votes are closed.