So, what i'm trying to do is there is a npc, and when it is not visible on the camera anymore, then it will disappear. I tried raycasting, but I don't know where to start. Please help on what I should probably use, to achieve my goal. Thank you!
✓ ANSWER ACCEPTED
How would I make it so when a player looks away from a npc, then the npc disappears?
2 answers
✓ Accepted answer
Yes, scripting helpers is NOT a request site, but I thought this was a good question.
You could use WorldToScreenPoint) to see if the parts isn't in the player's view.
Code:
local withinScreenBounds = Camera:WorldToScreenPoint(part.Position)
if not withinScreenBounds then
end
U could make a script ina a part, and ad a click detector (u can do this with UI, but i dont know how)
script.Parent.ClickDetector.MouseHoverLeave:connect(function() -- Detect Mouse Hover Leave.
script.Parent.Parent:Destroy() -- Destroy Parent.
end)
maybe (DownVotes come fast XD)
4 comments
0
does that giant "-1" mean i did it wrong? XD
0
yez
0
actually means someone down voted your answer, in this case bc it don't have a explanation
0
oh
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I get the property you mean, but I don't get why you use two variables and what withinScreenBounds means.
My apologies, I didn't notice that I added an addition variable. Also, withinScreenBounds is just a variable.