Ok, I have taken up the task of adding to the Fairy Network Lua Entity I worked on 2 years ago.
I’ve a bit of a problem though.
Players on my server complained about how they hated the fact that when their fairy got accidentally deleted, or eaten by a stargate, that they would need to re-join the server to get the fairy to respawn - they are disabled from the spawn menu.
To remedy this, I added a bit of code to the onRemove event of the entity, if the fairy was removed, or destroyed, without a specific variable being set, then it would trigger the fairy to spawn again. So another words, the fairy cannot be removed, unless specifically asked to leave via chat command.
Anyhow… I’ve encountered a side effect.
Apparently, when the server is exited, via an ‘exit’ command, while players are logged in, all the players entities or props etc, get destroyed or something before the server quits, this however, interacts with my fairy safeguard function, triggering an infinite loop.
1 - Ask server to exit
2 - Tries to destroy props etc
3 - Destroys fairy
4 - No variable set on fairy -
5 - Recreates the fairy
6 - Server is still trying to quit
7 - Destroys fairy
8 - No Variable set on fairy -
9 - Recreates fairy…
This process continues indefinitly
I was wondering if anyone knows how to create a global variable that I can set on the Server, that can be set on the Shutdown hook, that my Fairy Spawn function could then check for, and decide whether or not to re-spawn the fairy?
Im more a C Sharp type of guy, so im not that up to date with how to declare global variables or how to create variables that other systems can access.