If you duplicated these water balloons as they are, they would be a lot of fun, but they would quickly eat up your world’s capacity. To optimize, we can reuse the sound and visual effects across a group of balloons. To get started, let’s zoom into the grouping, select both the visual and sound effects, and then bring them out by clicking zoom out.
Now in our script we will move these to the balloon, on collision with a player. To do this, on the Motion tab, under Instant Motion, bring MoveTo over to the Collision With Player event.
On our Operators tab, about halfway down under Object Transformation is Position of Object, replace the vector value with this codeblock. And then from our Values tab we can bring Self into the empty Object slot. Duplicate the MoveTo Codeblock, and from our Variables tab, we can define what is being moved. Drag the Sound and VisualEffect variables onto the left side of each of the MoveTo events.
Like that, the script is more efficient. Now test that it works. And when we duplicate the water balloon it will stay referenced to the Sound and Visual effects. I recommend we duplicate a set of 5-10 balloons, and then duplicate another set but with the sound and visual effect.
We can paint these different colors. And now each team has a set of balloons and their own effects, which improves the visual look and feel. Now we’re ready for a water balloon fight!