Discuss Scratch

stalebell510042
Scratcher
9 posts

The if block isn’t working

this block
if <> then

end

Is not working, I tried using this script:
when I receive [Join v]
if <key [s v] pressed?> then
say [Hello, welcome to the shop] for (2) secs
end

The code does not work whatsoever this is a piece of an important game I am constantly updating called ScratchBlox.
You can check it out in my profile but how do I use this block?

Last edited by stalebell510042 (Feb. 20, 2025 09:52:29)

deck26
Scratcher
1000+ posts

The if block isn’t working

That script will only check for the key being pressed in the split second after the broadcast was made. I suspect you want it to start checking repeatedly for the s key being pressed after the broadcast. That is best done with

forever
if <key [ v] pressed?> then

end
end

OR

wait until <key [ v] pressed?> 
stalebell510042
Scratcher
9 posts

The if block isn’t working

deck26 wrote:

That script will only check for the key being pressed in the split second after the broadcast was made. I suspect you want it to start checking repeatedly for the s key being pressed after the broadcast. That is best done with

forever
if <key [ v] pressed?> then

end
end

OR

wait until <key [ v] pressed?> 

Thank you bro

Powered by DjangoBB