Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make a brick shrink, grow, and go transparent over time?

Asked by 8 years ago

Talking about making things such as this: https://www.youtube.com/watch?v=Lf3pZZDlG2w&index=35&list=WL

He is currently my friend, and he said he learned Lua in a matter of three days. I haven't asked to see the script, and I am afraid he'll decline, and assume I'm just trying to steal it. I want to know how to make:

The brick with the particle emitter

The sphere gradually shrink, and grow.

The sphere change in transparency

And just all around, figure out how to mash it all up into a delicious cake of scripting goodness.

0
Three days? He must know another language then. Really, Lua's syntax is incredibly easy to play with. But if this is his first language, wow, that guy is good. Rodmane234 85 — 8y
0
I made meteors fall from the sky in four days :P User#11440 120 — 8y
0
You are a god. Butterbrad99 10 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago
  1. The brick with the ParticleEmitter: This is quite simple really. All you need to do to create a ParticleEmitter is insert a ParticleEmitter object in a part. After that, it's just playing around with the properties to find what you want.

  2. Making the sphere grow and shrink: Again, extremely simple. To do this, you'd use a loop. There are three kinds, for, while, and repeat. The one that you should probably use is for, because you can loop it for a certain amount of time. To get a sphere to shrink and grow, we'd do something like this:

for i = 1, 10 do
    sphere.Size  = sphere.Size + Vector3.new(1, 1, 1)
    wait()
end
for i = 1, 10 do
    sphere.Size = sphere.Size - Vector3.new(1, 1, 1)
end
  1. Making the sphere change in transparency: This is basically the exact same thing as making a block grow, you'd use a loop. Whenever you want to show a gradual change in something without repeating your code, loop.
for i = 1, 5 do
    sphere.Transparency = sphere.Transparency + 0.1
    wait()
end
for i = 1, 5 do
    sphere.Transparency = sphere.Transparency - 0.1
end

If you have any other questions, feel free to message me, and don't forget to accept the answer if it helped you!

1
To add to this answer, if you wanted to have multiple of these loops executing at the same time in the same script, it's probably easiest to use coroutines: http://wiki.roblox.com/index.php?title=Beginners_Guide_to_Coroutines chess123mate 5873 — 8y
1
simple math > coroutines User#11440 120 — 8y
Ad

Answer this question