Hi, in Verse I’m trying to apply <suspends>
to a function subscribed through TriggeredEvent (when a player hits a trigger device), so that I can let the function sleep on demand. A simple example of this would be: When a player hits the trigger, sleep for 3 seconds and play an audio to that player only. This can probably be achieved without Verse, but I’m trying to see how it would be done through Verse so that I can use it for more complex matters.
So I know how to apply <suspends>
so that functions can sleep:
ForMainFunction(Agent:agent): void =
spawn:
MainFunction(Agent)
MainFunction(Agent:agent)<suspends>:void=
Sleep(3.0)
MyAudio.Play(Agent)
And I know how to validate the agent who did the triggering:
MainFunction(Agent:?agent):void=
if:
ValidAgent:=Agent?
MyPlayer:player=player[ValidAgent]
then:
# rest of the code, using ValidAgent instead of Agent
But now I need to combine these two snippets into one thing, which is the hard part for me. Some help would be great, thanks in advance✌