Discuss Scratch

Hammykat-_-
Scratcher
62 posts

Reducing lag on a scratch project

Hey there! So I've noticed a lot of people having issues with lag on their projects so I guess I just decided to make this… :3
Here's a list of all the reasons of possible lag on your project!

1) Unnecessary forever loops: These seriously put a huge weight on the system. Try reducing them or making the code more effecient!

2) Calculations: Every calculation your project makes puts a load on the system. If you've got 50 different clones running complex calculations every single frame, it's probably going to create huge amounts of lag! Try reducing the amount of calculations and the amount of times per second they appear.

3) Glitches: Well every site's got it's glitches, right? Same with scratch. (No offense ST ) On scratch, there are some glitches (That'll probably get sorted out in the near future) which could include glitched inputs or stuff like that. A good method is saving the project and reloading your tab. If that doesn't work, just replace the code

4) Cloud variables: If your project uses cloud variables… The scratch cloud servers aren't the most reliable. There are projects and ways to see if they aren't working, but just know that they don't work some of the time. If they stop working and then scratch fixes the issue, rename your variable and then set the name back to it's old name.

5) FPS and turbo mode: Every frame scratch updates the entire screen (which is 172,800 pixels by the way!). Running a scratch project that is very visual puts immense load on the project, and therefore could make it slow or laggy. And using turbo mode doubles the frame rate, which also doubles the load and therefore the lag! I would just recommend not using turbo mode, as it also makes your protect run faster than you might want it to.

6) Cloning: Scratch has ‘fencing’, which are limits to how many clones you can have on the screen (and also not being able to move out of the screen). Scratch has a limit of up to 300 clones at a time. If you have clones that run complex code, it might make your project slower. Also MAKE SURE TO DELETE YOUR CLONES AFTER USING THEM! This happens so much… It lags your project and new clones can't spawn if there are too many.

Well, I really hope this helped
(Also no offence ST ur amazing :3)
ihaveproblemz
Scratcher
22 posts

Reducing lag on a scratch project

7) Your project is too goated:
Play your project on turbowarp
8) Your computer is from when the dinosaurs roamed the earth:
Get a new computer
Industrialized
Scratcher
33 posts

Reducing lag on a scratch project

uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh help with scripts is to ASK for help with scripts, not to make instructions
Hammykat-_-
Scratcher
62 posts

Reducing lag on a scratch project

Industrialized wrote:

uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh help with scripts is to ASK for help with scripts, not to make instructions

Yeah ig but I saw a literal TUTORIAL here so… lol
Hammykat-_-
Scratcher
62 posts

Reducing lag on a scratch project

ihaveproblemz wrote:

7) Your project is too goated:
Play your project on turbowarp
8) Your computer is from when the dinosaurs roamed the earth:
Get a new computer

9) Tysm :3

10) True bro this is a crusty musty school device

Last edited by Hammykat-_- (April 19, 2026 15:06:35)

awesome-llama
Scratcher
1000+ posts

Reducing lag on a scratch project

Hammykat-_- wrote:

1) Unnecessary forever loops: These seriously put a huge weight on the system. Try reducing them or making the code more effecient!
This is often reported but is there actually any evidence for this? More loops could correlate with lag due to running more blocks, but you couldn't really say that the forever loop was the problem in that case. Alternatives like broadcasts are likely to be slower and combining scripts is likely not going to have a measurable impact.
THEIMPORTANT
Scratcher
500+ posts

Reducing lag on a scratch project

Hammykat-_- wrote:

ihaveproblemz wrote:

7) Your project is too goated:
Play your project on turbowarp
8) Your computer is from when the dinosaurs roamed the earth:
Get a new computer

9) Tysm :3

10) True bro this is a crusty musty school device

Don't worry. As bad as it is. Scratch limits CPU power. You can get the world's most powerful CPU chip, but on Scratch it will still lag because Scratch only uses a fraction of your CPU's full power. Turbowarp is a straightforward answer, but not everyone is going to use that. Use optimisations. Their are many optimizations like list searching and correct algorithm uses but its not too easy.
awesome-llama
Scratcher
1000+ posts

Reducing lag on a scratch project

THEIMPORTANT wrote:

Don't worry. As bad as it is. Scratch limits CPU power. You can get the world's most powerful CPU chip, but on Scratch it will still lag because Scratch only uses a fraction of your CPU's full power. Turbowarp is a straightforward answer, but not everyone is going to use that.
Scratch doesnt utilise multiple CPU cores for running scripts. TurboWarp doesn't either.
RokCoder
Scratcher
1000+ posts

Reducing lag on a scratch project

Lag in Scratch is almost always caused by poor code structure (including non-refresh custom blocks that execute over multiple frames).

There are exceptions. For example, if your program attempts to update every pixel on the screen using the pen, then it won't run at 30 fps.

Having a lot of forever loops isn't going to cause lag. It does make it difficult to follow the flow of code, though, which makes it easier for mistakes to slip into your coding.

Consider this -

when flag clicked
set x to (-240)
forever
set [count v] to (0)
repeat (9)
change [count v] by (pick random (1) to (4))
end
change x by (count)

On its own, this will run at 30 fps, moving the sprite along by random amounts each frame. If you also have the following code running, then it will drop down to moving the sprite at 3 fps -

when flag clicked
forever
set y to (0)

You can reduce the complexity of your code and make numerous other changes that will give micro-improvements, but actual lag is generally caused by not structuring your code well and not understanding the underlying principles of how Scratch works.
scratch_020115
Scratcher
5 posts

Reducing lag on a scratch project

Great Suggestion bro i will try on my project its fps is less than absolute zero

_meow_

Powered by DjangoBB