How do I attach a scrip on a tilemap?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jujumumu

When I place down a block using the tile map I want it to do something. Adding a script in the tscn then converting it to a tileset does not seem to work how can I do this?

:bust_in_silhouette: Reply From: Holm

In the Scene-Window click your tilemap and click at the “Attach a new or existing script for the selected node” icon (you can find that at the Scene-Window line at the top right corner). This work fine for me.

:bust_in_silhouette: Reply From: rzuf

You can’t have scripts attached to tiles.
The way to do this is having a script that will swap the tiles you’d like to do something special with actual nodes when the scene loads. Here’s a script that does exactly this: swap_tiles_with_objects()