How to attach server side script to player when player is added/respawned

is this possible to do?

I have many enemy blocks in my game and I think it could be more efficient to add touched event to player instead of each of those blocks. this is because player dies when it touches blocks but it is ok for blocks to touch each other so player touched event will occur once before player dies.

All examples i found so far put touched event on part. (e.g. this post)

StarterCharacterScripts comes the closets but its doc says

these scripts will not persist when the player respawns

It is a misunderstanding. The scripts will be added again if the player respawns, but the existing script of the dead character will not persist.

1 Like

By placing a script inside of StarterCharacterScripts, it will automatically clone the script again into the character on spawn.

However, what the documentation means is that if you want to store information (ex. variables) that persists even if the player resets, you need to do it elsewhere because the existing script will be destroyed.

1 Like

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