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

This transparency loop should take 0.1 transparency every 0.5 seconds, but it won't?

This script should minus the parts inside the model's transparency by 0.1 every half a second after a button is clicked, but it only changes the transparency of 1 part.

Script:

local model = workspace.model1:GetChildren()
local button = workspace.button1.ClickDetector

button.MouseClick:Connect(function(onclicked)

for i,v in pairs(model) do
	repeat
		v.Transparency = v.Transparency - 0.1
		wait(0.5)
	until v.Transparency == -0.1
end

end)

3 comments

0

I dont know what you are using repeat for, but I always put the wait() right after "do" so it it immediately waits before proceeding.

0

Code runs line by line which is why everything won't change at the same time. Your repeat until loop wont change all the bricks transparency's at the same time unless you use spawn or cooroutines. Also you might get issues with floating point numbers. Try instead: until v.Transparency <= -0.1.

0

Your script will make one part at a time go transparent. Each part will take 5.5 seconds. Are you sure this is what you want?

1 answer

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