Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to stop a script from running
- MyCodingStory
-
Scratcher
77 posts
How to stop a script from running
I am creating a project wherein when the user/s press the d key the script should stop running, but i tried a code but it did not work for me 
The code i used
And i tried surrounding the stop block with a forever loop but it still did not work.
If you know the solution please help me it would be helpful!
———————————————————————————-
Check out MyCodingStory

The code i used
when [ v] key pressed
stop [ v]
And i tried surrounding the stop block with a forever loop but it still did not work.
If you know the solution please help me it would be helpful!
———————————————————————————-
Check out MyCodingStory
- deck26
-
Scratcher
1000+ posts
How to stop a script from running
Is that the only script the sprite is running - in which case use ‘stop other scripts in sprite’? If not, is the running script running in a loop and you can either use a variable or key pressed block to stop the script within the loop.
Sharing the project means we don't have to guess.
Sharing the project means we don't have to guess.
- MyCodingStory
-
Scratcher
77 posts
How to stop a script from running
Is that the only script the sprite is running - in which case use ‘stop other scripts in sprite’? If not, is the running script running in a loop and you can either use a variable or key pressed block to stop the script within the loop.
Sharing the project means we don't have to guess.
All of the sprites are running..How do i stop a sprite by making a variable?
- deck26
-
Scratcher
1000+ posts
How to stop a script from running
You mean stop a script, presumably. If the script has something likeIs that the only script the sprite is running - in which case use ‘stop other scripts in sprite’? If not, is the running script running in a loop and you can either use a variable or key pressed block to stop the script within the loop.
Sharing the project means we don't have to guess.
All of the sprites are running..How do i stop a sprite by making a variable?
repeat until <(stopme) = [1]>then
your script here
end
when [d v] key pressed
set [stopme v] to [1]
- AlexDaGamerismyYT
-
Scratcher
14 posts
How to stop a script from running
you could do this
when I receive [ v]
stop [ v]
Last edited by AlexDaGamerismyYT (Feb. 8, 2021 08:47:49)
- Sahal44
-
Scratcher
9 posts
How to stop a script from running
when green flag clicked
forever
if <> then
<key [ v] pressed?>
stop [ v]
end
end
- Sahal44
-
Scratcher
9 posts
How to stop a script from running
when green flag clicked
forever
if <> then
<key [ v] pressed?>
stop [ v]
end
end
hmmm what have i done i am new to this discuss thing
- Sahal44
-
Scratcher
9 posts
How to stop a script from running
when green flag clicked
forever
if <> then
<key [ v] pressed?>
stop [ v]
end
end
hmmm what have i done i am new to this discuss thing
- deck26
-
Scratcher
1000+ posts
How to stop a script from running
The green tick above the message box will show you how the post will appear. Scratchblocks can be tricky at first but there's a sticky topic at the top of the forum for testing.when green flag clicked
forever
if <> then
<key [ v] pressed?>
stop [ v]
end
end
hmmm what have i done i am new to this discuss thing
You can also create a post and check it with the green tick but not actually submit it if you decide not to post it. Try to avoid duplicating posts.
Last edited by deck26 (Feb. 8, 2021 09:13:37)
- SpitB
-
Scratcher
7 posts
How to stop a script from running
I am creating a project wherein when the user/s press the d key the script should stop running, but i tried a code but it did not work for meTry:
The code i usedwhen [ v] key pressed
stop [ v]
And i tried surrounding the stop block with a forever loop but it still did not work.
If you know the solution please help me it would be helpful!
———————————————————————————-
Check out MyCodingStory
when green flag clicked
forever
if <> then
<key [ d] pressed?>
end
stop [ v]
Last edited by SpitB (Feb. 8, 2021 09:15:32)
- guhhhhhhh1234
-
New Scratcher
3 posts
How to stop a script from running
I am creating a video motion project where you can choose different options, but there is one option that has sound and the script won't stop running when I choose a different option, does anyone know how to help me?
Script I used:
I am using a scratch tutorial where you pop the ballons. I only want it to stop until the choice for this has been chosen again.
Script I used:
when video motion > (25)
play sound [Pop v] until done
go to [random position v]
change [color v] effect by (25)
wait until <key [ 1v] pressed?>
stop [this script v]
I am using a scratch tutorial where you pop the ballons. I only want it to stop until the choice for this has been chosen again.
Last edited by guhhhhhhh1234 (Nov. 13, 2024 01:54:02)
- guhhhhhhh1234
-
New Scratcher
3 posts
How to stop a script from running
I am creating a video motion project where you can choose different options, but there is one option that has sound and the script won't stop running when I choose a different option, does anyone know how to help me?There was a typo in:
Script I used:when video motion > (25)
play sound [Pop v] until done
go to [random position v]
change [color v] effect by (25)
wait until <key [ 1v] pressed?>
stop [this script v]
I am using a scratch tutorial where you pop the ballons. I only want it to stop until the choice for this has been chosen again.
wait until <key [1v] pressed?>I meant it as this:
wait until <key [1] pressed?>
- Underwhite
-
Scratcher
100+ posts
How to stop a script from running
stop [other scripts in sprite v]
stop [this script v]
prob has your answer, + stop script.
did you use the stop this script block or the stop all block?
- Underwhite
-
Scratcher
100+ posts
How to stop a script from running
Nah.. I think it'sI am creating a video motion project where you can choose different options, but there is one option that has sound and the script won't stop running when I choose a different option, does anyone know how to help me?There was a typo in:
Script I used:when video motion > (25)
play sound [Pop v] until done
go to [random position v]
change [color v] effect by (25)
wait until <key [ 1v] pressed?>
stop [this script v]
I am using a scratch tutorial where you pop the ballons. I only want it to stop until the choice for this has been chosen again.wait until <key [1v] pressed?>I meant it as this:wait until <key [1] pressed?>
<key [1 v] pressed?>
like <key (insert bracket here it removes my text) 1 v (insert another bracket here again) pressed?>
- Discussion Forums
- » Help with Scripts
-
» How to stop a script from running








