So I made a part and I need more parts to be made around it like in this picture:
The red is the center object. The object I need to put parts around
Anyhow, how would I do this
So I made a part and I need more parts to be made around it like in this picture:
The red is the center object. The object I need to put parts around
Anyhow, how would I do this
You would do something like:
local part = Instance.new(“Part”)
part.Position = redPart.Position + offset
part.Parent = workspace
Thats the thing. I dont know how I would get the offset
Just to add the offset needs to have all 3 values, X, Y, Z changed respectively.
You could try experiment with a loop (for i = x) or something for one half, then reverse it for other, ive never done this so i dont know where to start but i guess this could help
Store it in a table, experiment with the right offset in Studio and change it at need
Or you only need one offset, set that offset, that’s the same for the 4 parts (the ones that make a +), and for the ones that form a x, it’s simply like this:
Let’s say the offset for the + parts is 10, to get the offset of the x parts, the offset is the offset (10) divided by 2 on both sides (multiplied on certain sides), in this case 5
Use cos and sin (respectively) to get the x and z positions.
I made this place for another post, it includes rotating the parts but you should be able to use it to do what you want. Just set the radius and the number of parts you require.
PartMove_Baseplate.rbxl (34.7 KB)
Neat thing too, if you change lines 36 and 37 to this:
local position = (hrp.CFrame * CFrame.new(x,0,z)).p;
local lookAt = hrp.Position;
The parts will follow the player.
Also, if you don’t want the parts to rotate towards the centre (like in your image) then remove line 37 and change line 38 to this:
part.CFrame = CFrame.new(position);
I have tried all of these things none of them seem to work.
The main reason being I cant figure out cause A: I dont understand it, And B: I dont know how I would modify it to work in my case. I need something more easier to understand.
If I cant understand it then I cant really get it to work
created a quick script. sin and cosine create circular affect due to unit circle.
function Createpart()
local part = Instance.new("Part")
part.Anchored = true
part.Size = Vector3.new(1,1,1)
part.Parent = workspace
return part
end
local Origin = script.Parent.Position
for i = 1,8,1 do
local Part = Createpart()
Part.Position = Origin + Vector3.new(math.cos(math.rad(i) * 45) * 3,0,math.sin(math.rad(i) * 45) * 3)
print(math.deg(math.rad(i) * 45)) -- proof it goes by 45 degrees each iteration
end
edit: ask any questions about my script if you need to (eg: explanation of its workings)
This worked perfectly! And I can see where I can customize it!
Its also very easy to read so thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.