Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

3 comments

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.

0

I made meteors fall from the sky in four days :P

0

You are a god.

1 answer

✓ Accepted answer
  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!

2 comments

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

1

simple math > coroutines

This discussion is preserved as it was. New answers, comments, and votes are closed.