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

BrickColor problem with for loops how do i fix this transparency wierd thing?

--Ok so I wrote up this script:

Part = script.Parent

while true do
	for i = 0,1,0.1 do
		Part.Transparency = i
		wait(0.01)
	end
	for i = 1,0,-0.1 do
		Part.Transparency = i
		wait(0.01)
	end
	Part.BrickColor = BrickColor.Random()
end

--But it changes when its fully un-transparent, not when it's done with the 2nd for-loop. I know i can just change the brickcolor line to after the 1st for-loop and it would work, but can anyone tell me why it wont change after the 2nd for-loop and changes after the 1st? ( why does it change when its visible and not invisible) Thanks any help would be appreciated

2 comments

0

I'm confused on the problem.

0

You confused me big time with ur issue. I haven't a clue what the issue is here because you literally contradicted yourself. At first you said it changes when it's completely un transparent which means it changes after the 2nd for loop(Which it should) and, towards the end you said it changes after the 1st for loop...

1 answer

Part = script.Parent

while true do
    for i = 0,1,0.1 do
        Part.Transparency = i
        wait(0.01)
    end
    Part.BrickColor = BrickColor.Random() --the for loops have to finish before the brick color change happen
    for i = 1,0,-0.1 do
        Part.Transparency = i
        wait(0.01)
    end
    Part.BrickColor = BrickColor.Random()
end

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