How to make the image label always stay within the frame when tweening?

like this Untitled

Set its position to scale against the containing frame.

The X component of its UDim2 positional value should be scaled (that way when the frame decreases in size the image label will move with it).

Umm uh…
Okay, i’m pretty sure i’m doing everything
wrong, can you explain better?

local frame = script.Parent
local wave = frame.wave

wait (10)

wave.Position = UDim2.new(0, 10, 0, 0)

UDim2.new(scaleX, offsetX, scaleY, offsetY)

That’s how UDim2 values work.

1 Like

I got it, but how should i scale it? When I try to put any numbers in scaleX the image just disappears, and when i try to put any number in offsetX it does what it does (goes beyond frame)

Does the tween move the image by offsetting it? You’ll need to handle that in regards to scale as well.

I think I might’ve found a perfect solution, i’m not sure tho. So i just putted the frame with the image inside ScrollingFrame and turns out the frame can’t go beyond it. I didn’t tried to tween it so far tho

Wait a heckin… SO THIS ENTIRE TIME I COULD’VE JUST SET “ClipsDescendants” TO TRUE. AWESOME. SIMPLY AWESOME.

2 Likes