I am trying to place parts from point 1 to point 2 via scripting with each part being getting closer to point 2 like in the images below
i have no idea how to do it so if you could help me i would really appreciate it C:
I am trying to place parts from point 1 to point 2 via scripting with each part being getting closer to point 2 like in the images below
I have got the solution, but ill hide it so you can figure it out yourself, heres some tips:
Try using a variable to decide how much parts are present, and their distances.
get the distance and direction vectors and multiply them by the iteration, the direction, and the distance between parts.
If your really stuck, heres the solution:
local startpart = workspace.start
local endpart = workspace.endp
local partsfolder = workspace.parts
local distance, direction = (endpart.Position - startpart.Position).Magnitude, (endpart.Position - startpart.Position).Unit
local studsbetweenpart = 5
local amountofparts = math.floor(distance / studsbetweenpart)
for i = 1, amountofparts do
local part = Instance.new("Part", partsfolder)
part.Anchored = true
part.Size = Vector3.new(1,1,1)
part.Position = startpart.Position + direction * i * studsbetweenpart
end
Also should be in Scripting Support
yayyyy c:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.