How should I go about changing the color of thousands of parts multiple times per second?

I recently learned about BulkMoveTo through the Wind Shake module, and I was wondering if any other functions existed to achieve similar behavior with different properties (rather than just CFrames).

For context, my spray painting game implements a feature where you can make your paint rainbow, which actively changes the color of (often) thousands of parts at a time, many times per second. The only issue is that, no matter how low I set the refresh rate of the paint, lag spikes occur every time it changes the parts’ color with a normal loop.

Is there a similar function to BulkMoveTo that deals with color?

I would use the ColorCorrectionEffect with which you can simply change the lightning of the entire game. By setting it to extreme colors you could end up in creating a disco-like effect.

ColorCorrectionEffect

tough ofc it doesn’t really change the color of the parts

I thought about this, but it unfortunately would not be the same effect that I’m looking for, as it would change the color of the entire map as well as non-rainbow paint.

You can break down the second into 60 heartbeats. If you need to change 1000 parts 3 times a second, you can split them into 20 groups of 50, and change their colors in groups. 50 color changes in a heartbeat seems a lot less intimidating than 1000 all at once.

1 Like

I actually did end up doing a method similar to this that is dependent of the player’s framerate, and it helps, but all it really does it just make the lag spikes occur 3 times per second rather than 10 times per second.

This solution does at least solve part of the problem, though!

How much other stuff is going on at the same time? Those spikes might be from the combined load of all your scripts.

I throw in heartbeat queues in a few places I think these lag spikes might be a problem. I also keep track of areas that no longer need to be in the queue (because people have left). No idea how laggy it will be, but I’m hopeful!

This is like a year too old reply, but u could UnionAsync() after a large amount of parts once they let go of left click or whatever thing stops the painting. The reason to only union after a large amount of parts is if u union too early, then players would just spam paint and the server would spam unionasyncs which breaks everything. hope this helped. :heart:

1 Like