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

How do I make a brick slowly disappear?

I already made a script,

local = bob
game.workspace.bob
bob=x
x.transparency = 0.4
wait(5)
x.transparency = 0.3
wait(5)
x.transparency = 0.2
wait(5)
x.transparency = 0.1
wait(5)
x.transparency = 0.0

  end

It is not working. Any help?

3 answers

Here you go:

local bob = game.workspace.bob
for num = 1,4 do
	bob.Transparency = bob.Transparency - 0.1
	wait(5)
end

1 comment

0

Thank you so much!

First of all, your defining and re-defining variables way more often than necessary. You only need to define the variable you want to use for the (I'm assuming) brick once. I'm guessing you want to use a variable "bob" to represent this brick and then change it's transparency.

This is the corrected version of your script (Assuming Workspace.bob exists):

local bob = game.Workspace.bob
bob.transparency = 0.4
wait(5)
bob.transparency = 0.3
wait(5)
bob.transparency = 0.2
wait(5)
bob.transparency = 0.1
wait(5)
bob.transparency = 0.0
end

However this script would be more efficient:


local bob = game.Workspace.bob
bob.Transparency = 0.4
for i=1, 4 do
wait(5)
bob.Transparency = bob.Transparency - 0.1
end
function Fade(part)
for i = part.Transparency, 1, 1 do
 Part.Transparency = i
wait()
end
end

Fade(bob)

What i did was make a fade function for ya

Heres how i did the for loop

It starts at the parts transparency then where it should end is 1 then it skips by 1 so say part.Transparency = .8 then The output

-> .8 -> .9 -> 1

2 comments

0

It says there is an error in line 2. Is there something I am doing wrong?

0

i fixed it recopy the code

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