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

Can't get this script to repeat itself, wat do?

First of all, howdy, I'm new and trying to teach myself to code, so I'll be asking questions here a lot probably. This is my first ever script so please be gentle and patient with me.

So, basically this script is supposed to make a brick become gradually more transparent until it reaches full transparency, then slowly make the brick visible again, and repeat the process infinitely. It does not.

The script in question:

brick = game.workspace.Part

if

	brick.Transparency == 0

then

	repeat

		brick.Transparency += .1

		wait(.5)

	until brick.Transparency == 1 

	wait(1)

elseif brick.Transparency == 1

then 

	repeat

		brick.Transparency -= .1
		
		wait(.5)

	until brick.Transparency == 0

	wait(1)
	
end

1 answer

✓ Accepted answer

Just put your code in a while true loop! It would look a little something like this

while true do
print("Code here!")
end

Your code should work fine like this. If this helps, please click accept. If you have any questions feel free to leave them below! (No need to have "Repeat" throughout your code)

Edit: you can also do this if your code is running to fast and you are lagging / getting errors:

while wait(0.1) do
	print("Code here!")
end

1 comment

0

I'm sorry! Since then I've changed the script a little more. I've inserted a tool, given it a handle and added my script into that. Now what I'm aiming for is for the tool to change transparency when "F" is pressed, and it isn't working once again.

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