Help on cloning multiple times and setting the angle randomly

I’m trying to recreate something similar to this video - YouTube I’ve been trying different methods to get it but I have had two main problems 1 cloning the object multiple times 2 setting the angles randomly relatively around the enemy player. heres my a snippet of my current code:

	local getTouchingParts = game.Workspace:FindPartsInRegion3(region, player.Character.HumanoidRootPart, math.huge)
	
		for i,v in pairs(getTouchingParts) do 
			if v.Parent.Name ~= player.Name then
				
			local tablec = {}
			
		for count = 1, 25 do
					local lc = lightMesh:Clone()
				
			table.insert(tablec, lc)
				

				for index, lc  in ipairs(tablec) do
					lc.Anchored = true
					lc.Position = player.Character.HumanoidRootPart.Position
					
						lc.Parent = workspace
						
					end
					local TheTable = {-42, 42} 

					local RandomAtTable = TheTable[math.random(#TheTable)]
					
					lc.CFrame = CFrame.Angles(math.rad(math.random(1, 42), math.rad(0),  math.rad(0)))
				end
			end
		end

For setting rotation randomly you can do something like this

workspace.Part.Rotation = Vector3.new(math.random(1,42),0,0)

So in your case:

lc.Rotation = Vector3.new(math.random(1,42),0,0)

Part rotation can’t be assigned directly. You’ll need to use CFrame angles:

lc.CFrame = lc.CFrame * CFrame.Angles(math.rad(math.random(0,359)),0,0)

any ideas on how to make the cloning work?

It works for me in my studio environment :man_shrugging:

If the variable lc is an object within the game you can call do something like

myClone = lc:Clone()

and go from there.

So for example you could do myClone.Anchored = true

did you look at the script ive gotten pretty far on cloning it i mean cloning mutiple times

It looks like your clone should be working, but I think your issue is that you need to finish the first for loop before you continue to the next and set everything, however I would just have one for loop and do everything in there, no need to put it all into a table until you want to do stuff with it later; you can set their position and rotation right after you create the clone.

your rotation with cframe worked thank you, any ideas on how it could look like in the video with the x shape i thought about just making two separate clones and setting there rotation to -42 and 44 each so it would look more of a x shape what do you think?

Are you referring to the cartoon ‘slashes’ in the video?

the thing about 2.5 seconds into the video is what im talking about when he dashes forward with the whiteish spikes around the enemy characters

Since when were you not able to assign rotation?

Since forever. Same with position. The CFrame functions and methods should be used instead for part transformations. The only time I can think of where you can directly use the position and orientation properties are when tweening objects.

It still looks like each slash is a random rotation. The video appears to use billboard UIs instead of parts for those effects but I might be wrong.