Before anyone tell me, yes I know there is a dedicated function or tweeting a GUI's position, in this instance it made more sense to tween it regularly. Im just trying to give the player an error message after the search a drawer, the Transparency part of the script works fine, but for whatever reason the GUI's moving to the wrong position.
local MoveGui = function(plr, TextTrans, NewPos)
local NewFrame = game.ServerStorage.NoItemFound:Clone()
print(NewPos)
NewFrame.Parent = plr.PlayerGui.Stamina
local TransTweenInfo = TweenInfo.new(
2.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local TransTweenProperties = {
TextTransparency = TextTrans,
Position = UDim2.new(NewPos)
}
TweenService:Create(NewFrame.TextLabel, TransTweenInfo, TransTweenProperties):play()
print(NewPos)
end
MoveGui(plr, 0, UDim2.new(1.27, 0,-0.75, 0))
Both prints I've put into the script have come back as "1.27, 0,-0.75, 0" so there is not a problem with the number. However, for some reason the GUI tweens itself to "0,0,0,0" and I really don't know why. Any ideas?

4 comments
Any errors?
nope, non
It's because you're contradicting the initialization arguments to UDim2 on line 16; NewPos is already a UDim2, by passing NewPos into the constructor you're conflicting the intake datatype which will have it default to {0, 0, 0, 0}. Simply just assign NewPos to Position.
Thanks!