guiObject issues! help

I am having an error when modifying the absolute position, size and rotation, whats wrong?

local guiObject = game.StarterGui.ScreenForTests.myButton

local screenGui = guiObject:FindFirstAncestor("ScreenForTests")

guiObject.AnchorPoint = Vector2.new(1, 1)

guiObject.AbsolutePosition = Vector2.new(33.8, 221.618)

guiObject.AbsoluteSize = Vector2.new(123, 50)

guiObject.AbsoluteRotation = 0

You can’t use a Vector2 value. GUI objects use UDim2.

i tried but still not working…

local guiObject = game.StarterGui.ScreenForTests.myButton
local screenGui = guiObject:FindFirstAncestor("ScreenForTests")

guiObject.AnchorPoint = UDim2.fromOffset(1,1)
guiObject.AbsolutePosition = UDim2.fromOffset(33.8, 221.618)
guiObject.AbsoluteSize = UDim2.fromOffset(123, 50)
guiObject.AbsoluteRotation = 0

AnchorPoint uses Vector2.
It tells you what type is expected in the error message.

Oh yeah, you also can’t use Absolute properties, those are read only. Use GuiObject.Position and GuiObject.Size.
See GuiObject.

guiObject.AnchorPoint = Vector2.new(1,1)
guiObject.Position = UDim2.new(33.8, 221.618)
guiObject.Size = UDim2.new(123, 50)
guiObject.Rotation = 0

It is not possible to change the absolute position?

And by chande do you know, how could i condition the positions for mobile devices and desktop devices?

AbsolutePosition is a read-only property that provides the screen position of a UI element in pixels.

If you want to position and scale UI on all devices, I’d recommend using plugins.

Zawie’s GUI Positioning Tools - Roblox
AutoScale Lite - Roblox

1 Like