It can’t be:
surface gui’s
decals on transparent parts
glass
but I have an idea, viewport frames??
yes i am making a scope that uses glass but I have been struggling for a long time trying to figure out how to get a reticle that appears far(ther) away, but its glass so its annoying, but it looks dang good
The only way to do this without abusing roblox render quirks is to use viewport frames with a surface gui, almost like a portal gun that displays a different yet similar scene. Viewports are generally pixelated, however.
If you’re fine with using render quirks, if a player has sufficiently high graphic settings, having a slightly transparent part behind a slightly opaque piece of glass will prevent it from rendering when looking through the glass. All that’s left is making this glass part cover up your entire screen and add a hole in it.
You can add a hitbox to the circle so that a ray cannot go through it, then cast a ray from the player’s camera to the part. If the ray hit something, then hide the part, but if it didn’t hit anything then show the part.
The only problem with this is that it only checks the center of the part, not all corners and sides.
Edit : Actually, I just thought of a better idea! Instead of raycasting, you could keep going towards the camera and see if it hit the hole.
local Camera = workspace.CurrentCamera
local Part = workspace.Part
local Hole = workspace.Hole
function isPartInHole()
local istouching = false
local Clone = Part:Clone()
Clone.Anchored = true
Clone.Parent = workspace
for i = 0, 1, .05 do
Clone.Position = Part.Position:Lerp(Camera.CFrame.Position,i)
if table.find(workspace:GetPartsInPart(Clone),Hole) then
istouching = true
break
end
end
Clone:Remove()
return istouching
end
Use view port frame
Put it in the middle of the circle(i wonder if it’s possible to add ui corner) put the part there
Add a script
In the script get the distance between the camera and the part in the viewport frame(part.position- camera.positon idk if its the other way around but you get it)
Get the distance between the camera in the workspace and the part
Add these two vectors together
Set it to the position of the camera in thr viewport frame
You are welcome