Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I set CFrame/Position based after previous clone?

I was messing around in studio (like I usually do) and was messing with a script when I got stuck here.

local yes = script.Parent:GetChildren()

for i = 1,#yes do
	
	if yes[i]:IsA("Accessory") then
		
		yes[i]:Destroy()
		
	end
	
end


for i = 1,10 do
	local hed = script.Parent:WaitForChild("Head"):Clone()
	hed.Parent = script.Parent
	

	hed.Position = hed.Position + Vector3.new(0,1,0)
	
end

ty for helping

EDIT: Forgot to provide enough info, so it clones the players head and I want them to keep stacking.

1 answer

This isn’t exactly a solution to the question, but you could do this:

local yes = script.Parent:GetChildren()

for i = 1,#yes do

    if yes[i]:IsA("Accessory") then

        yes[i]:Destroy()

    end

end


for i = 1,10 do
    local hed = script.Parent:WaitForChild("Head"):Clone()
    hed.Parent = script.Parent


    hed.Position = hed.Position + Vector3.new(0,i * 3,0) — goes up by 3 every loop

end

This discussion is preserved as it was. New answers, comments, and votes are closed.