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 fade script?

I have tried the following

script.parent = button

functionFade() -- Im not sure if this is right but thats not the problem

button.ImageTransparency = 0.1
wait(.1)
button.ImageTransparency = 0.1

and increases till it gets to 1








end

-- Then I call the function once clicked(Did not put that in the question)

1 comment

1

wat

3 answers

Use a "for loop."

script.parent = button
function cat()
	for i = 0, 1, 0.1 do
		button.ImageTransparency = i
		wait(0.1)
	end
end
button.MouseButton1Click:connect(cat)

Using loops can get the result you want

button = script.Parent

for i = 0, 1, 0.1 do --we can use this to loop it till it gets to 1 (for i = 0 = starting loop, 1 = end of loop, 0.1 = speed of loop)
  button.Transparency = i --make sure it = i
  wait(.1)
end

if this helped please accept :D ~KIHeros

Another but longer way is by doing this:

script.parent = button

function onClick 

button.Transparency  =  0.1
wait(.1)
button.Transparency =  0.2
wait(.1)
button.Transparency  =  0.3
wait(.1)
button.Transparency =  0.4
wait(.1)
button.Transparency  =  0.5
wait(.1)
button.Transparency =  0.6
wait(.1)
button.Transparency  =  0.7
wait(.1)
button.Transparency =  0.8
wait(.1)
button.Transparency =  0.9
wait(.1) button.Transparency =  1
end

button.ClickDetector.MouseClick:connect(onClick)

This is another way to do it if you have a brick fading. Just make sure theres a click detector in button too. This is the way to go if you are a beginer scripter as it shows you some basic functions.

1 comment

0

That is way to inefficient and will waste time and make the code look bad and improper. I used to do that and it took about 5-8 minutes.

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