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!
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)