So I don’t know how but for some reason one of my GUIs isn’t tweeting to scale. The tween works perfectly and goes to the right position on the default view but when I change it to iPhone view it goes to a completely different position. None of my other GUIs have done this.
Code:
local SuccessMessageIn = Tween:Create(Success,TweenInfo.new(0.75,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out),{Position = UDim2.new(0, 473,0, 0)})
You are using “pixels”(not sure what it’s called) to tween. This means that its size is varied from screen to screen. In order to achieve the same position on everywhere, you need to use the scale properties, which scales the frame to a portion of the screen. So for example, UDim2.new(0.3,0,0.2,0) will create a frame which will have a ratio of 3:10 in the x axis and a ratio of 2:10 y axis. (Scale is the first property of each axis in UDim2)
in this part, you should manipulate the scale property of UDim2 too, so this can be replaced as:
{Position = UDim2.new(0.45, 0,0, 0)}
note that this is just an example of how you can change it, the value is adjustable.
I’m still a little confused. I want to have the GUI come down from the top into the middle. How would I get the position for the middle? If possible, could you give me the position?
If you want it in the middle, set the anchor point of the Ui element to 0.5,0.5. Then tween the position to 0.5,0,0.5,0 instead and you should be good to go!
Alright well, I put the middle position on my computer into the tween and it works perfectly. When I switch my view to mobile to check the scaling & positioning it’s completely messed up. It’s only the X axis that doesn’t seem to work.