Get position of previous clone

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to move clones of a gui down each time a new clone comes.

  1. What is the issue? Include screenshots / videos if possible!

I don’t have any method to get it to work, I need the position of the previous clone somehow.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have looked around a lot but can’t find any issue similiar to mine.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

I don’t really have much code to show since I haven’t found any method yet.
I hope you understand the issue anyways.

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Have you written any code for this at all? If so, you should post it with your question.

How I’d do this is keep track of all of the “clones” in a Table, and update the Positions based on their index. e.g:

local clones = {}

function receiveClone(clone)
    table.insert(clones, 1, clone)
    for i, v in pairs(clones) do
        v.Position = UDim2.new(0,0,0,200*(i-1))
    end
end

I am unsure of what you are asking as you don’t have any code that you have provided, so I will give you what I assume you are asking for.

local original = -- Reference the original part here
local clone = original:Clone() -- Clones the part
local cloneposition = clone.Position -- Gets the position of the clone as a variable

Something like what I did before but I still have no idea how to move down each individual clone.

I am unsure of what you mean by “What I did before” as you haven’t provided any images and / or code with information on what you have already tried. If you could give some sort of explanation on what you did before it would be much appreciated as we will be able to resolve this issue you have.

I could try to recover my past code that I kind off forgot about.

local Events = game.ReplicatedStorage:WaitForChild("Events")
local SendOrderEvent = Events:WaitForChild("SendOrder")

local Orders = 0



SendOrderEvent.OnServerEvent:Connect(function(player, PlayerName)
	
	local PlayerGUI = player.PlayerGui
	local orderClaimScreen = PlayerGUI.orderClaimingScreen
	local OrderScreen = orderClaimScreen.OrderScreen
	local OrderSign = OrderScreen.OrderSign
	local Order = OrderSign.Order
	
	local OrderClone = Order:Clone()
	OrderClone.Visible = false
	
	print("Works!")
	
	if Orders == 0 then
		
		OrderClone.Visible = true
		
		Orders = 1
		
		OrderClone.TextLabel.Text = PlayerName.Value
		
	elseif Orders == 1 then		
		
		OrderClone.Position = Order.Position + UDim2.new(0, 0, 0, 25)
		
		Orders = 2
		
		OrderClone.TextLabel.Text = PlayerName.Value
		
		OrderClone.Visible = true
		
	elseif Orders == 2 then
		
		local OrderClonePosition = OrderClone.Position + UDim2.new(0, 0, 0, 25)
		
		OrderClone.Position = OrderClonePosition
		
		OrderClone.TextLabel.Text = PlayerName.Value
		
		OrderClone.Visible = true
		
	end
	
end)

Hopefully it isn’t to confusing.

Oh, I see. I don’t really know myself either. Perhaps someone else may have the answer.

I hope somebody can help atleast, thanks for trying to help me.

If you’ve already written some piece of code, then please do provide it here. And also, try to elaborate as I don’t understand the question.

1 Like

I found the sulotion, I didn’t have to manually code it I just need some ui layout stuff.