Make color more red when the object gets close, when the object is farther it goes more green

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to make a text that gets greener when the object is far, redder when its closer.

  2. What is the issue? I don’t really know how to do it.

  3. What solutions have you tried so far? I’ve tried it with magnitude, but i didn’t know how much studs were too far/too close.

Can someone please help me ? I have no clue on how to do this.


Please show your script.

Also you are the one that chooses how far away should be displayed green and how close it shoud be changing to red. A simple way would be to place a dummy character on the baseplate then put a Part on the baseplate at the dummy’s feet. Change the length of the Part to what you figure the green should start changing to red, and at what point it should be completely red. Those will be your Magnitude distances in Studs.

Thank you for the information, If I struggle I’ll reply back.

What you could do is create tween. The tween goal is green when the magnitude is high, and red when it’s low (which means the character is near it)
Then, pause the tween if the character isn’t moving. (Humanoid.MoveDirection)

The issue with changing it only when the player moves is that if the object is moving as well you wouldn’t see it change.
Best to use a change of Magnitude, since that’s what the colour change is based on.

You should probably reply to @toolinjection because they have the script. I just made the suggestion of using Magnitude.