Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

[SOLVED] How do I change the position of one UI element to the position of another element?

Asked by 4 years ago
Edited 4 years ago

I already tried doing this and it did not work.

I used a LocalScript Here is my script:

wait()
while true do
    wait()
    script.Parent.Position = UDim2.new(script.Parent.Parent.TextButton.Position)
end

Any help would be appreciated, thanks.

0
Any errors? Dovydas1118 1495 — 4y
0
Nope Dave_Robertson 42 — 4y

1 answer

Log in to vote
0
Answered by
blazar04 281 Moderation Voter
4 years ago

You don't need to create a new UDim2 instance because TextButton's position property is a UDim2 value. https://developer.roblox.com/en-us/api-reference/class/TextButton If you go to that link and scroll to position, you can see it says "UDim2."

So, the script would look like this:

wait()
while true do
    wait()
    script.Parent.Position = script.Parent.Parent.TextButton.Position
end
0
How do I accept your answer? Dave_Robertson 42 — 4y
0
There should be a button at my answer that says "Accept answer". An upvote would be appreciated, too .Thanks! blazar04 281 — 4y
0
I don't see the accept answer button and I need 25 reputation to upvote. Dave_Robertson 42 — 4y
0
Oh yeah, forgot about the upvote requirement. The accept answer button should be there (I think it might say "Mark as solution" idk) blazar04 281 — 4y
Ad

Answer this question