What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Ye but nothing helped.
Here’s the code i tried.
local studs = script.Studs
local start = workspace.StudsPart.Start
local originalStud = 1
local function generateStud()
local cloneStuds = studs:Clone()
originalStud = originalStud + cloneStuds.Size.X
cloneStuds.Parent = workspace.StudsPart
cloneStuds.SurfaceGui.TextLabel.Text = originalStud
cloneStuds.CFrame -= Vector3.new(0,0,originalStud)
cloneStuds.Size = cloneStuds.Size + Vector3.new(originalStud,0,0)
end
while wait(0.1) do
generateStud()
end
I want it so it generates parts by 1 studs, sizes them by 1 stud and positions them also by 1 stud like in “Yeet a Friend”.
Is there a child under the script named “Studs” if not shouldn’t it be
local studs = script.Parent
(I am assuming this script is parented to a part)
The information you provided is fairly vague and I don’t see how your explorer is set up (as in where the script is and what the child “Studs” is.
Please correct me if I’m wrong, hope this helped.
local studTemplate = script.Studs
local start = workspace.StudsPart.Start
local currentXPos = start.Position.X + studTemplate.Size.X
local function generateStud(studNum)
local cloneStuds = studTemplate:Clone()
cloneStuds.Parent = workspace.StudsPart
cloneStuds.SurfaceGui.TextLabel.Text = tostring(studNum)
cloneStuds.CFrame = CFrame.new(currentXPos, start.Position.Y, start.Position.Z)
cloneStuds.Size = Vector3.new(1, cloneStuds.Size.Y, cloneStuds.Size.Z)
currentXPos = currentXPos + cloneStuds.Size.X
end
local studNum = 1
while wait(0.1) do
generateStud(studNum)
studNum = studNum + 1
end
I believe this should work well, this code takes the starting point from start.Position , and then for each new stud, it increments currentXPos by the size of the stud in the X dimension (cloneStuds.Size.X ), effectively placing each new stud one stud away from the previous one. The studNum keeps track of the current stud number.