Turning a player invisible for 20 seconds, then showing him back

So i’m making this device where, when the Input Trigger is pressed, the player turns invisible. I’m using F.Hide, Sleep, and F.Show. The problem is that i can’t find a wait make the “On begin” part to function. I’ll give you my whole Verse code so you can find a way to make it work.

using { /Fortnite.com/Devices }

using { /Verse.org/Simulation }

using { /UnrealEngine.com/Temporary/Diagnostics }

using { /Fortnite.com/Characters }

Invisibility := class(creative_device):

@editable

InputTrigger : input_trigger_device = input_trigger_device{}



OnInputPressed( P : agent)<suspends> : void =

    if (F := P.GetFortCharacter\[\]):

        F.Hide()



        Sleep(20.0)



        F.Show()

OnBegin<override>()<suspends>:void=

(Idk what to put here, pls help, thx)

Hi ZERO, Welcome to the Forums.

I’ve never seen “[\]” from: if (F := P.GetFortCharacter\[\]): do you know what the purpose of those brackets and backslash are?

Also, in the Input Trigger API - I see there is a ‘PressedEvent’ - I think you’d need to link that ‘OnInputPressed’ function to the trigger with a subscription. (Something like InputTrigger.PressedEvent.Subscribe(OnInputPressed))

It might also help to break this down into 2 separate problems, one of which would be getting the input to trigger/register in verse, and the other being the invisibility/hiding functionality.

You could use a print-string (Print("Input Succeeded")) to test the input side, and set it up with a Button Device to test the functionality side.

Let me know if you make any forward progress with that info, happy to dive deeper if need be.