Discarded Forum

Discarded Forum
Discarded Forum

1 Like

You’re looping through the entire transparency range of one group (including a wait) before moving to the next.

Use a coroutine or a task around the transparency loop, or just use TweenService to kick off these loops without waiting, which would probably make more sense for this anyways.

1 Like

He just gave you the answer for that.

You’re using task.wait()'s within the for loops which cause the delay.

1 Like

It would maybe help if you described what you want the end result to be. Should each group’s parts fade out one-by-one, but each group does so independently? Should all parts fade out at the same time? Something else?

1 Like

I’m sorry, I’m having some trouble understanding the problem. Are you saying that group 2 fades out, then there’s one second of delay, and then group 1 fades out?

1 Like

Use coroutines, you’re making 1 group to fade out, then you add a wait which delays 1 second and then makes the other group fade out.

1 Like

What do you mean by this? If you know what they are, this is self explanatory.
Some fake code to explain your question:

create coroutine
in coroutine add loop
courotine resume
loop for the other group
1 Like

Honestly, now that I understand the problem more, I’d not recommend a separate task or coroutines, at least to start.

Instead, swap your loops around so the transparency loop is the outermost:

while true do
	for MainTransparency = 0, 1.15, .3 do 
		for _, BothGroups in pairs(workspace.SGMSystem:GetChildren()) do
			local parts = {BothGroups.SGMS1,BothGroups.SGMS2}
			for _, part in parts do
				part.Head.Lens.Transparency = MainTransparency
			end
		end
		task.wait(0.03) 
	end
	task.wait(1)
end

(I also moved your waits around a bit to reflect what I think you intended)

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.