Coding a system that effects transparency and masking on a SurfaceGUI

Im not great at coding, im looking for a way to explain this to a friend that knows coding

*Currrently the glow looks like this (Desired Effect):
image

But issues with it occur, im currently using [Always On Top] for my desired effect, and issues occur such as it appearing through parts, yes I know I can modify the z index and max visible distance but thats not the effect im looking for.

*Issue:
image

Now what im talking about with a “Transparency”, and “Mask” system as explained :

Transparency : The further away the player is from said SurfaceGUI, the imagelabel within it gets more transparent (1) and the closer the player is to it, its lesstransparent (0).

Mask : A system where if the SurfaceGUI is behind a part the size of the SurfaceGUI gets smaller. Such as looking at a sun in the game and theres some cool looking godrays, but as soon as you go behind a part/object they get smaller.

1 Like

For the script, it would/should be a LocalScript inside the Light Emitting part. (LocalScript so that it only effects each Player’s clients individually)

It would check the .Magnitude (distance) between the player and the part, and would go through different thresholds/ranges.

Example logic:

-- this is *NOT* code, but coding logic:

If player’s distance from part is > 5 studs then
   {Set Screengui’s transparency to 0.3}

But, if player’s distance from part is < 5, then
   {Set Screengui’s transparency to 0.9}

(Very light example)

As for THIS, I will get back to you on that.
:wink::+1:

I will try to reply with a solution to the Mask part in the next few days. Definitely stay tuned for that. :slightly_smiling_face:

1 Like

Never would have thought about using a “Light Emiiting Part”, is that more better than using for example 8 raycasts in front of the player?

1 Like

I just used “Light Emitting Part” to reference your block with the neon blue.

I haven’t had much experience with Raycasting yet. I plan to learn though.

What I provided is just what “I” might do to achieve what you asked. I am not a “Pro OG Master Deity” Scripter. :sweat_smile:

I am just a mid-rookie who saw another user needing help, so I explained what I personally would do and would be able to do with my current knowledge I have at hand at this moment in time. :slightly_smiling_face:

(Lol)