Tricks for improve the perfomance!

Hello! :smiley:

I will share some tricks to improve the performance of the game too much. You will only need very little knowledge to understand :slight_smile:


  • Do not use deprecated functions: Roblox updates some functions, makes them better, even with more improvements! In exchange for that, the previous versions of the functions become obsolete/about to be obsolete
    This could cause too much stress if you worked hard on a game.
    An example of a deprecated function is wait(). Instead, use task.wait()

For example, in functions like:

while wait() do
print("Howwie :3")
end

use instead:

while task.wait(0.03) --that is equivalent to a frame. if you use task.wait, will act like runservice.runbeat
print("Howwie :3")
end

and using task.wait() its 2x faster and 2x better!


  • Do not use CastShadow in all parts: Shadows take time to calculate, if for example you have too many parts unnecessarily with cast shadow, it can be fatal to performance. If I can later, I will make a dynamic castshadow system! :D, Roblox still does not have an efficient optimization system.

  • Donโ€™t use unions: If you do simple things itโ€™s fine!, but too many unions can also be fatal with performance. Therefore, use meshes for more advanced things.

Also, the circles in the unions are a nightmare of 2700 triangles :(.


  • Have a loading asset system: Some people will have a low connection, so when you try to play some audio, for example: JUMPSCARE, it will play with a delay, and the player will not be scared at that precise moment.

  • Play with the lighting much better: What do I mean by this? You must define the style of the game very well, for example, if it is cartoony, the shadows should be a slightly purple tone. or if realistic, add vignette and other effects. and adjusting the contrast is also important.

That would be all! If you have any trick, leave it below!

Thank you very much for reading :D.

6 Likes

Also, check this: All about optimization

These are some great basic tips!

And i also want to add something:
If you disable the cantouch and canquery properties you can save some frames, however only do this if youโ€™re never gonna interact with that part again(cantouch disables .Touched events and canquery disables raycasting calculations from that part)

3 Likes

task.wait() just like Heartbeat runs based on your FPS, which if you have 60 FPS, it will run 60 times a second, wait() runs at 30 FPS, is slower than task.wait() and also Deprecated.

Here you are telling task.wait() to run at 30 FPS, which is the exact same as wait()

It is also good advice to not use loops like this, because it takes a lot of resources to run loops, instead you should use Events, which are more efficient.

1 Like

This is false actually, the recommended way of doing it is going to be:

while true do 
    task.wait()
end 

constructs, since these arenโ€™t guaranteed to run exactly every frame or gameplay step. Instead, use events like Stepped or Heartbeat. Similarly, avoid using spawn() or delay() as they use the same internal mechanics as wait(). Uses of spawn() are generally better served with coroutine.wrap() and coroutine.resume() of the coroutine library.

3 Likes