If the Camera is in LockFirstPerson then you could insert a clickdetector inside the specific parts and then insert this script inside the clickdetector
local ClickDetector = script.Parent
local Time = 5 --time in seconds until the part is invisible
local DestroyedAfterTime = false --[[if set to true then the part will be
destroyed after its invisible]]
ClickDetector.MouseHoverEnter:Connect(function()
game:GetService("TweenService"):Create(ClickDetector.Parent,TweenInfo.new(Time,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{Transparency = 1}):Play()
if DestroyedAfterTime == true then
wait(Time)
ClickDetector.Parent:Destroy()
end
end)
--NOT TOO SURE IF IT WORKS! will be tested
Test results: WORKS!
not exactly what you wanted, but atleast its something? gonna make the camera thing if u want it
field of vision, i’m making a horror game and i’m trying to make a subtle jumpscare by having there be some monster on the side of the screen. it will suddenly dissapear when it enters the side of their screen and in their field of view.
so the only way to tell if they’re looking at a part is to see if they’re hovering their mouse over it? what if i were to position the part right NEXT to their currentcamera and have a big hitbox around it. when you hit the invisible hitbox with your mouse it would set the transparency to 1. Do you think that would work?
local pos, onScreen = Camera:WorldToScreenPoint(object) -- Pos = Vector2 (dont Care), onScreen = Bool, true if on screen, false if not.
Remember that the onScreen bool will be true, even if there is a wall in between, If you care about walls, Then you should use raycast, to see if there is a wall inbetween or not,