Duplicate a Part into Itself

Hi! I’m working on an obby game and I am trying to change the hitbox of a part using a script. I have the scripting covered but I was wondering if it is possible to duplicate a part into itself without duplicating it and moving it into itself manually. I have 50 stages, and I want to duplicate them all but make their parent part be the original, non-duplicated part. I hope someone understands what I am trying to get at. I have searched for a solution but to no avail. Please help!

2 Likes

You mean cloning the part, then parenting that clone into the part?

local clone = part:Clone()
clone.Parent = part

No I’d like to do it in studio, not in a script

1 Like

Just… create another Part inside?

There is no way of doing that other than duplicating and moving the part into the original in studio, unless you want to paste a script into the console that can do it.

Where it says ‘run a command’ you can paste in a script

2 Likes

im doing it more than 50 times, very tedious

ill try that and ill let you know

1 Like

ended up running this code:

for _, v in pairs(workspace.Stages:GetChildren()) do
	local clone = v:Clone()
	clone.Parent = v
	clone.Name = "hitbox"
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.