Hello all, have a wee issue here. It’s a little hard to explain but if my explanation doesn’t make sense then skip to the bottom for the main question
In the game I’m creating when the player dies they aren’t actually killed yet. I just mark them as Dying with an attribute until they choose whether to revive or not. That’s all fine. But I’ve hit a snag.
I have a boss that if he catches you he challenges you with a math question. While you are being challenged you are frozen (i.e. Walk speed is zero). This is on purpose so that you are vulnerable to getting killed by other bosses. So when this boss catches you the server fires a Remote function (because it needs to wait until player has either answered incorrect or correct) for the player’s local GUI script to take over with the challenge. IF while you are being challenged, you get killed by a different boss, the challenge GUI stays there and also the local script doesn’t get the chance to return back a value.
My idea which seems rather messy is that the client when it gets fired, runs a co routine to constantly check if the player has been marked as Dying (Another boss, got the player). If it finds that to be true then stop the quiz and cleanup all the GUI stuff…The problem I have is that the co routine cannot return a value back to the original boss that called the Remote Function. So the boss will just sit there waiting for a reply
The only solution I can think of is when the co routine does find the player Dying true, then cleanup the GUI’s and then destroy the original Boss and spawn another one in it’s place to carry on with his business.
Just wondering if there would be a better way.
Long story short…Can a remote function script run a co_routine that will return a value back to the originating script?