How do I make a script that makes a mesh transparent when a player is not touching it?

This is probably a newbie question, but how would I make a script that detects if a player is not touching a mesh and make the mesh transparent? So that if the player’s character is touching the mesh, its transparency is set 0, but if the player’s character is not touching the mesh, then the transparency is set to 1.

I’ve tried making a script on this, but it’s a bit tricky (for me at least) to do this, since meshes have no collision if they’re bigger than their parent part. Though, there’s probably some event that does not require collision with the object for the script to run.

I’ve also tried to look on the devforum for similar issues but I couldn’t find anything relevant to my issue.
Any help is appreciated.

2 Likes

If you use a MeshPart instead of a Mesh, it will have accurate collision, which you can then check with WorldRoot | Documentation - Roblox Creator Hub

1 Like