How can I change the Offset of a UI

Hello!

While developping my StartUp Gui I wanted to make an “animation”.
To put it briefly I’m trying to lower the offset of the UI.

It’s in a loop if you know what I mean.
So I am trying to shrink it by diving the offset by 0.2

Exept when I do this:

script.Parent.Title.CurrentNight.Size = script.Parent.Title.CurrentNight.Size.X.Offset / 0.2

What the Output gives me is “cannot asign Offset To”

I’ve tried looking up on the dev hub and forum. But it wasn’t fitting for what I was trying to do.
Extra: I’ll do the same for y axis.

Thanks for reading!

You need to give it an UDim2

local night = script.Parent.Title.CurrentNight
local size = night.Size
night.Size = UDim2.new(size.X.Scale,size.X.Offset / 0.2,size.Y.Scale,size.Y.Offset)
2 Likes

I ran into an issue, it modifies the Scale unit. Which I do not want.

So, your using offset. use UDim2.fromOffset

2 Likes

That shouldn’t happen though as the 2nd and 4th are Offsets, not scales. If you’re only using offset, then just change it to use fromOffset

local night = script.Parent.Title.CurrentNight
local size = night.Size
night.Size = UDim2.fromOffset(size.X.Offset / 0.2,size.Y.Offset / 0.2)
2 Likes