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
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?
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.