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

Why isn't WorldToScreenPoint working at all?

Asked by
2_MMZ 1059 Moderation Voter
2 years ago

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
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. greatneil80 2647 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago

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

Ad

Answer this question