I was testing out my script and I thought of an idea to have a move I want to make, and the cylinder that fades out is supposed to happen while the twister and the black circle are increasing in size, so I put them in a for i loop. The weird thing is, is that first the black circle and twister just pop out of nowhere, the cylinder changes, and then the black circle and twister change.

Here's a GIF of what I mean: https://gyazo.com/408a6be6df739e9473763b3bf12f27c2

My script, don't mind the unused variables, I'll use them later once this problem is fixed:

local TS = game:GetService("TweenService")


game.ReplicatedStorage.ShadowMagic.ShadowR.OnServerEvent:Connect(function(plr)
	
	local char = plr.Character
	
	
	local Shockwave = game.Workspace.Shockwave:Clone()
	Shockwave.Parent = game.Workspace
	Shockwave.CFrame = plr.Character.Torso.CFrame
	Shockwave.Anchored = true
	Shockwave.CanCollide = false
	Shockwave.Transparency = 1
	Shockwave.Mesh.Scale = Vector3.new(0,0,0)
	
	local twister = game.Workspace.Twister:Clone()
	twister.Parent = game.Workspace
	twister.Size = Vector3.new(0,0,0)
	twister.CFrame = plr.Character.Torso.CFrame
	twister.Transparency = 1
	
	local bottom = workspace.ShadowCylinder:Clone()
	bottom.Size = Vector3.new(0.5,0,0)
	bottom.Anchored = true
	bottom.CanCollide = false
	bottom.CFrame = char.Torso.CFrame + Vector3.new(0,-2.5,0)
	bottom.Parent = workspace
	bottom.Orientation = Vector3.new(0,0,90)
	
	
	local Cylinder = bottom:Clone()
	Cylinder.Size = Vector3.new(0.5,20,20)
	Cylinder.Position = plr.Character.Torso.Position + Vector3.new(0,-2,0)
	Cylinder.Anchored = true
	Cylinder.CanCollide = false
	Cylinder.Transparency = 0.2
	Cylinder.Material = "SmoothPlastic"
	Cylinder.Parent = game.Workspace
	Cylinder.Name = "ShadCyl"
	
	
	
	
	
	
	for i = 1,20 do
		bottom.Size = bottom.Size + Vector3.new(0,1,1)
		
		
		twister.Size = twister.Size + Vector3.new(4.5,1,4.5)
		twister.Transparency = twister.Transparency - 0.0085
		
		if i == 10 then
			
			
			
		for i = 1,25 do
		
			Cylinder.Size = Cylinder.Size + Vector3.new(6,-2,-2)
			Cylinder.Transparency = Cylinder.Transparency + 0.05
			wait()
		
		
		
		end
	
			
			
			
		end
		
		
		
		
		
		
		
		
		
		
		
		wait()
	end
	
	local Cloud = game.ReplicatedStorage.ShadowMagic.Cloud:Clone()
	Cloud.Size = Vector3.new(0,0,0)
	
	
	for i = 0,1,.1 do
		
		Shockwave.Transparency = i
		Shockwave.Mesh.Scale  = Shockwave.Mesh.Scale + Vector3.new(3,.7,3)
		
		wait()
	end
	
	
	
	
	
	
	
	
	
	
end)

2 comments

0

you can change i to anything, try not to overwrite the variable with different loops because you might need both values (you could do something like i1, i2, or something that actually reflects what it's used for)

0

How would I use what you're saying if I wanted the first loop to happen and the if I == 10 occur while that's happening?