JS help

testing world js script pic
why doesnt this work

:person_shrugging:
IDK.

You aren't waiting for the function to complete so it won't return anything.

how do i make it wait

You don't, you just have to do a some funky stuff in both snap and javascript to get it to work.

but if you replace return with document.write then that works. can you make return work

You can do something like this: TI-84 Emulator - #34 by ego-lay_atman-bay

no. i think i figured it out. the code was supposed to report every change in battery. so mabey thats preventing it from reporting

i just cant seem to get anything that isnt instant working.


can you help

Did you see the rest of the script? Setting the result to a variable, the wait block, and the if check is important.

i tried. it wasnt working for me