What is wrong with my code?

I keep getting an error message saying "C:/Unreal Projects/Quick1v1/Plugins/Quick1v1/Content/go_invisible_device.verse(17,46, 17,47) : Script error 3104: Dangling = assignment with no expressions or empty braced block {} on its right hand side.

Welcome to the forum, I’ll see if I can help.

When posting code it’s best not to post an image, but post text - you can highlight the text and click on the </> symbol to have it shown as code in the message.

A couple things that may be issues.

Try changing

if (IsCrouched?):

to

if (IsCrouched = true):

I don’t put colons on my if’s and then’s, but they may be optional/ok.

In some places the indentation is off (too far indented, or not enough indented)

If you can repost it as text, I can copy/paste into UEFN and check the syntax better.

There’s a huge indent problem at line 18, as stated in the error :

go_invisible_device.verse(17,46, 17,47) # line 17, col 46
1 Like

make sure the spacing is right :smile:

if (FortCharacter := Agent.GetFortCharacter[]):

in line 18 make sure it’s in the third column under

HandleSpawnEvent ( Agent : agent) : void =

if you have problems with spacing you can use {} like this

    HandleSpawnEvent(Agent:agent) : void = {
        if (FortCharacter := Agent.GetFortCharacter[]):
            FortCharacter.CrouchedEvent().Subscribe(GoInvisibleOnCrouch)
    }

Good Luck :+1:

Hey, I hope you are in good health. I have a question: When I use the player search here, does the function search for all the players or just the player who crouch?

<> if (FortCharacter := Agent.GetFortCharacter):
FortCharacter.CrouchedEvent().Subscribe(GoInvisibleOnCrouch)
} </>

From what I see you’re using CrouchedEvent on an agent so you’re triggering this event when one agent crouched and sent a signal to GoInvisibleOnCrouch. this is for the player who crouched only