Function not working for some reason and only a line of it actually runs

The way it’s supposed to work is that when one of the buttons is pressed, it runs code inside the function PhoneRing(). When I playtest, the “Phone is ringing” message prints but the rest doesn’t do anything (btw OrderTimer runs on game start)

    OnBegin<override>()<suspends>:void=
        # TODO: Replace this with your code



        OrderTimer.SuccessEvent.Subscribe(PhoneRing)
        ButtonRestaurant1.InteractedWithEvent.Subscribe(OnOrderTaken)
        TakeOrderTimeout.SuccessEvent.Subscribe(PhoneStopRing)


    PhoneStopRing(Agent:?agent):void=
        ButtonRestaurant1.Disable
        ButtonRestaurant2.Disable
    
    PhoneRing(Agent:?agent):void=
        ButtonRestaurant1.Enable
        ButtonRestaurant2.Enable
        TakeOrderTimeout.Start()
        Print("Phone is ringing")

I’ve been stuck on this for a while. Can anyone help?

If ButtonRestaurant1, ButtonRestaurant2, and TakeOrderTimeout are @editable variables, are you sure you have them populated in the creative_device you’ve put on your island? I’ve failed to do this a few times.

2 Likes

The Enable and Disable method calls are missing the (), they should be called like this:

ButtonRestaurant1.Enable()
ButtonRestaurant2.Enable()

ButtonRestaurant1.Disable()
ButtonRestaurant2.Disable()

Also make sure after Verse changes to recompile using:
UEFN Menu > Verse > Build Verse Code

1 Like

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