Help with collectables

can someone help me detect when the player is touching an enitty and if they are it checks if they are pressing a key then destroy it

Hi @Kayden_Dougherty ,

You can use collisions and triggers to detect when that happens, here is a good tutorial:

And instead of playing a sound as the tutorial does, you can call entity.destroy() to remove the item, if the player entered the item and is pressing a key.

but it wont destroy when i hit e but thats fine

You can add the following line in your trigger enter callback:


A post was split to a new topic: My script doesn’t work