How to modify these for loops to make the rock craters spawn in different angles

for k = 1, rows do
		local Angle = 0
		for i = 1,numrocks do
			local Part = Instance.new("Part")
			Part.Anchored = true
			Part.Size = Vector3.new(1,1,1)
			local randomDistance = distance * (math.random(85, 100) / 100) -- random distance between 75% and 125% of original distance
			local randomAngle = Orientation + math.random(-14, 14)

			Part.CFrame = cf * CFrame.fromEulerAnglesXYZ(0,math.rad(Angle),0) * CFrame.new(distance,1,0) * CFrame.Angles(0,0,math.rad(randomAngle))
			local randomPlaceBelow = PlaceBelow * (math.random(90,100) / 100)


			local final
			task.delay(20, function()
				Part:Destroy()
			end)

			local RayCast = workspace:Raycast(Part.Position,Part.CFrame.UpVector * - RayCastNumber1, RayParams)

			if RayCast then
				Smoothen(Part)
				Part.Position = RayCast.Position + Part.CFrame.UpVector * randomPlaceBelow
				final = Part.Position
				Part.Position = Part.Position + Part.CFrame.UpVector * 1.2 * randomPlaceBelow
				Part.Material = RayCast.Instance.Material
				Part.Color = RayCast.Instance.Color
				Part.Size = Vector3.new(Size,Size2,Size3)
				--Part.Orientation = Vector3.new(math.random(-180, 180),math.random(-180, 180),math.random(-180, 180))
				Part.Parent = workspace.DebrisFolder
				if RayCast.Instance:HasTag("Wall") then
					Part.Position = Part.Position + Part.CFrame.UpVector * -1
				end
				local tween = TweenService:Create(Part, TweenInfo.new(.15, Enum.EasingStyle.Linear), {Position = final})
				tween:Play()
				tween.Completed:Once(function()
					tween:Destroy()
				end)
				task.delay(15, function()
					local tween = TweenService:Create(Part, TweenInfo.new(3), {Position = Part.Position + Part.CFrame.UpVector * -3.5, Size = Part.Size / math.random(.58, .95)})
					tween:Play()
					tween.Completed:Once(function()
						tween:Destroy()
					end)
				end)
				for _, v in pairs(RayCast.Instance:GetChildren()) do
					if v:IsA("Texture") then
						v:Clone().Parent = Part
					end
				end

				--local Tween = TweenService:Create(Part,TweenInfo.new(.25,Enum.EasingStyle.Bounce,Enum.EasingDirection.In),{Position = Part.Position + Part.CFrame.UpVector * 5}):Play()

				--task.delay(7,function()

				--	local Tween = TweenService:Create(Part,TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Position = Part.Position + Part.CFrame.UpVector}):Play()
				--end)

			end
			if not autoAngle then
				Angle+=AngleNumber
			else
				Angle = Angle + 360/numrocks
			end
			if i == numrocks then
				Angle = 0
			end
		end
	end

this is the code ive tried to make, the for loops using i creates the rock craters, and yes, the autoAngle variable at the bottom of the script is true in my case, although turning it off wouldnt make too much of a change
i need help in order to tell the script that for each row to place the crater at a different rotation (kinda). because now, if i make the craters be more distanced from each other, they are still positioned the same, but i want them to “rotate” in the sense so that if i call 100 rows for example in the same spot, it wouldnt be hundreds of rocks z fighting in the same position, but something like a perfect circle.

image
as you can see in the picture, the rows are working if i modify the distance using k, but theyre perfectly in line with each other, thats what im trying to change

nevermind, took the approach to run the function multiple times with different settings

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