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

How do I get an UIElement's position when it's affected by an UIListLayout?

Hello dear Scriptinghelpers community! My Goal is to make a nice menu in which the user can choose a value from a table. I want to Display the Options on the side of the screen in a Frame (Transparency = 1) with a UIListLayout. I would LOVE to tween the Options but I Need to get their positions for that. My plan is to parent everything to the Frame with the UiListLayout, copy the positions of everything, remove the Layout and Set everyging's Position to the saved one. However

Element.Position

Is equal to UDim2(0,0,0,0) and in the Properties window it says:

Element's Position is overridden by UiListLayout.

Is there any way I get can the Element's Position?

1 answer

✓ Accepted answer

There you go bud Delete the UIListLayout since you don't need it anymore This script emitates the UiListListLayout but doesn't OverRide it so you could change it at any time Edit this script to the way you desire then execute it in console in roblox studio

children=game.StarterGui.ScreenGui.Frame:GetChildren() -- Path to the Textboxes/Labels/etc that you need them to be fixed in position
distanceperone=.126 -- Distance left per one
Axis="Y" -- Which axis do you want it to go

increment=0 -- Don't change this one
for i=1,#children do
	if children[i]:IsA("TextLabel") or children[i]:IsA("TextButton") or children[i]:IsA("TextBox") then
		children[i].Position=UDim2.new(0,0,0,0)
		if Axis=="X" then
		children[i].Position=children[i].Position+UDim2.new(increment,0,0,0)
		elseif Axis=="Y" then
			children[i].Position=children[i].Position+UDim2.new(0,0,increment,0)
		end
		increment=increment+distanceperone
	end
end
-- execute me in console

1 comment

0

Wow, thanks you so much! <3

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