Udim2 position not equal to regular position

I’m trying to tween my UI buttons into a place in the screen, but when i use Udim2, the position isn’t the actual position I set it to.
Example: i set it to the middle of the screen and it goes to the top left instead


local tweenService = game:GetService("TweenService")

local player = game.Players.LocalPlayer
local orderText = player.PlayerGui:WaitForChild("Starter").Background.Main.Order
local playBttn = player.PlayerGui:WaitForChild("Starter").Background.Main.Play
local shopBttn = player.PlayerGui:WaitForChild("Starter").Background.Main.Shop
local rose = player.PlayerGui:WaitForChild("Starter").Background.Main.Order.rose

local orderInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local playInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local shopInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local roseInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.In)

local playGoal1 = {Position = UDim2.new({0.352, 0},{0.401, 0})}	
local shopGoal1 = {Position = UDim2.new({0.352, 0},{0.625, 0})}
local orderGoal1 = {TextTransparency = 0}
local roseGoal1 = {ImageTransparency = 0}

local playGoal2 = {TextTransparency = 1}
local shopGoal2 = {TextTransparency = 1}
local orderGoal2 = {TextTransparency = 1}
local roseGoal2 = {ImageTransparency = 1}

local orderTween1 = tweenService:Create(orderText, orderInfo, orderGoal1)
local orderTween2 = tweenService:Create(orderText, orderInfo, orderGoal2)
local roseTween1 = tweenService:Create(rose, roseInfo, roseGoal1)
local roseTween2 = tweenService:Create(rose, roseInfo, roseGoal2)
local playTween1 = tweenService:Create(playBttn, playInfo, playGoal1)
local playTween2 = tweenService:Create(playBttn, playInfo, playGoal2)
local shopTween1 = tweenService:Create(shopBttn, shopInfo, shopGoal1)
local shopTween2 = tweenService:Create(shopBttn, shopInfo, shopGoal2)

repeat wait() until player.Character:FindFirstChild("Humanoid") ~= nil

Because your UDim2 is not .5, 0, .5, 0. I guess you did lower values because of the AnchorPoint, which you can set to .5, .5 so when positioning at .5, 0, .5, 0 it is in the middle.

I don’t want it in the middle, I was just giving an example of how offset it was.

these positions here are the positions I want them to move to, but the UDim2 is not moving them there.

local playGoal1 = {Position = UDim2.new(0.352, 0,0.401, 0)}	
local shopGoal1 = {Position = UDim2.new(0.352, 0,0.625, 0)}

No need for brackets.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.