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

Why don't the text labels move up if I have Position+UDim2.new?

I want a Textabel to be created and be sorted like a list(by going up one everytime),but it won't do that.All the TextLabels just have the same position

names = {"Bob","Tod","Jake","Dude","Wut" }--The names
for i,v in pairs (names) do
print(v)
h = Instance.new("TextLabel",script.Parent)
h. Text = v
h.Name = v
h.Size = UDim2.new(0,100,0,100)
wait(1)
h.Position = h.Position+UDim2.new(0,0,1,0)--For each name move up one
end

2 comments

0

Oops, I mean't to put for each name move up one.

0

You are able to edit your question, so you don't have to point out errors in the comments. :P

1 answer

You have to manually add or subtract each component individually. Unlike Vector3, UDim2 does not support component math like that.

Change line 9 in that block to this:

h.Position = UDim2.new(h.Position.X.Scale, h.Position.X.Offset + 1, h.Position.Y.Scale, h.Position.Y.Offset)

1 comment

0

How can I manually add and subtract it?

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