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

How can I set this loop to alternate a brick's transparency?

I want the brick "Eyelid1" to alternate between transparency 1 and 0 every (0.5) seconds endlessly in a loop. Where am I going wrong? Also note, I put "Eyelid1" in a folder named "Eyelid".

while true do
game.Workspace.Eyelid.Eyelid1.Transparency = 1
wait(0.5)
game.Workspace.Eyelid.Eyelid1.Transparency = 0
end

3 answers

✓ Accepted answer
local part = script.Parent

while true do
	part.Transparency = 1
	wait(0.5)
	part.Transparency = 0
	wait(0.5) -- this makes it so it can start over
end

1 comment

0

Thank you so much! I'll have to get better at my structure. :)

local part=--your part
while true do
if part.Transparency==0 then
part.Transparency=1


else

part.Transparency=0


end



wait(0.5)
end

4 comments

0

Workspace.Eyelid.Eyelid1.Script:3: 'then' expected near '='

0

oops

0

there try it now

0

there try it now

If you want the eyes to close more smoothly, then you can use a for i loop.

while true do
for i = 1, 20 do
game.Workspace.Eyelid.Eyelid1.Transparency - 0.05
wait(0.02)
end

for i = 1, 20 do
game.Workspace.Eyelid.Eyelid1.Transparency + 0.05
wait(0.02)
end
end

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