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

How do I make a brick slowly disappear?

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago

Here you go:

local bob = game.workspace.bob
for num = 1,4 do
    bob.Transparency = bob.Transparency - 0.1
    wait(5)
end
0
Thank you so much! collinman60 10 — 10y
Ad
Log in to vote
0
Answered by
jav2612 180
10 years ago

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
Log in to vote
0
Answered by 10 years ago
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

0
It says there is an error in line 2. Is there something I am doing wrong? collinman60 10 — 10y
0
i fixed it recopy the code DragonSkyye 517 — 10y

Answer this question