Finding treasure script help

Hi all, I have a tool in the form of a metal detector. I will need to use it to find hidden treasures, but how do I make this system right? I want that when the player with the tool is on the site of the treasure produced a sound, as well as blinking gui light on the screen player and after 5 seconds appeared cross on the ground, but provided that the player has not left the treasure. I’m not asking to write me a code, just an idea how to do it

Maybe make a touched event and then check if the hitpart is the treasure and if it is then do the sounds and the blinking gui light? But only do that if you have some hitbox that reaches some amount into the ground so that it could actually touch the treasure. I don’t know if this way would work cause I can’t test right now.

I had the same idea, but you have to stand on it for 5 seconds to detect the treasure, and the touch event doesn’t provide for such a thing

Would you be able to use gettouchingparts() and then do a for loop that checks every .1 seconds to see if it is touching but if it stops touching it wont do the noise and stuff but if it still is then it will? This might not work either.

1 Like

Thanks, I’ll give it a try and post :wink:


Unfortunately, the character animation glitches due to part in my metal detector because it is too big, so need another option. I hope I explained it clearly, if you have any questions, I’ll be glad to answer them

Are you able to make a video that shows how it glitches? Or if you can’t maybe some pictures that show how it glitches?

1 Like

Now in the video I wanted to show how bad it is, and it started working fine :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.