My TweenSize doesn't work IN GAME, but it does in Studio

I am having a strange issue. My TweenSize doesn’t work. The Size doesnt get PHYSICALLY affected.


The Console tells me that it changes, but I don’t see a difference.
May it be caused by my UI Constraint?
The TweenSize works in Studio, so why wouldn’t it IN GAME?

IN STUDIO
https://gyazo.com/ca201013f67496fa12a6b3e1aeebde20

IN GAME
https://gyazo.com/9d80ed929ce8532484b215258508d64b

Here’s the script:

local CloseButton = FridgeBackground:FindFirstChild("CloseButton")
local BeforeHoverSize = CloseButton.Size

--Play Animation for Close Button (When Hovering)
CloseButton.MouseEnter:Connect(function()
	local BeforeHoverSize = CloseButton.Size
	local HoverSize = UDim2.new(BeforeHoverSize.X.Scale*0.8, 0,BeforeHoverSize.Y.Scale*0.8, 0)
	CloseButton:TweenSize(HoverSize, "Out", "Quad", 0.01)
	print("After Tween is "..tostring(HoverSize))
	--Close Button
	CloseButton.MouseButton1Down:Connect(function()
		FridgeBackground.Visible = false
		Shade.Visible = false
	end)
end)

--Stop Animation when stop horvering
CloseButton.MouseLeave:Connect(function()
	CloseButton:TweenSize(BeforeHoverSize, "In", "Sine", 0.01)
	print("Before Tween is "..tostring(BeforeHoverSize))
end)```

Please Help Me

That’s not how it works. Check TweenService:Create arguments.

I am using TweenSize for gui, not TweenService
https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenSize

I see, i’ve had to lie with this before, i’d try to change scale with a offset multiplication.

hmm, can you show an example? I dont quite understand what you mean by that.
You want me to UDim2.new() and multiplicate the Offset (which is 0) by a number?

Well, why do you need to include the offset btw?

because its part of the required arguments for UDim2.new to make TweenSize work

Okay, I set the TextButton BackgroundTransparency to 0. So this is what it gives me. I have a UI Constraint and a UI Stroke inside the TextButton. Yes, the X is Text and Yes, I already set it Scaled = true

https://gyazo.com/c0c840b5442742f6035e9bdfa06f02f4

There’s a good chance that some sort of UI constraint is preventing your UI from re-sizing, l

There’s also a chance :TweenSize() and :TweenPosition() are acting up.

This post reports issues when select EasingStyles are used with :TweenSize() and :TweenPosition().
The general idea I get from reading posts on the developer forum is that Roblox doesn’t care about these functions anymore and would prefer developers use TweenService.
For ease of use, use a function like this,

local TweenService = game:GetService("TweenService")
local TweenInfo1 = TweenInfo.new(20, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)

local function Tween(Object, Info, Target, WaitToFinish)
	local NewTween = TweenService:Create(Object, Info, Target)
	NewTween:Play()
	
	if WaitToFinish then
		NewTween.Completed:Wait()
	end
	
	NewTween:Destroy()
	NewTween = nil
end

Example:

Tween(workspace, TweenInfo1, {Gravity = 20})

So I have to make a TweenService:Create() with TweenService and set the Target to my UDim2.new values and it should work? TweenService does work with GuiObjects right?

Okay, I found out if I set my AnchorPoint to (0, 0). The Animation actually works, but it doesnt scale it like “centered”. It makes it smaller, but it goes like towards a direction, its not like the button becomes smaller in the middle. Is there a way to fix that?

This is what I mean by that. https://gyazo.com/9076e58adb3ba5e91c73435e9e4fa6ef

Its like the Text doesnt scale with the Button

Yeah, using the function it would look something like this,

Tween(TextButton, TweenInfo1, {Size = UDim2.new(0,32,0,45)})

To be clear, are you sure there are no UI constraints preventing your UI from moving around?

Yes, there is no UI Constraint preventing me. I tried removing it and it still doesn’t work. I also did the animation using your TweenService method instead

Look like it’s just the Text that doesn’t want to get scaled when I Tween the button. Do you think there is a way to fix that?

Enable the TextScaled property inside the TextButton.

If the scaling doesn’t work as you’d like, use the TextBounds property and size properties inside the TextButton to figure out how much space the text is taking up and how you want to scale it to fit within the box.

If you are picking the second route, make sure TextWrapped in the TextButton is disabled.

I already Enabled the TextScaled Property. I will have to take the 2nd route. I dont understand what exactly you want me to do using TextBounds

I found the issue!

In Studio, if we closed every tab and pressed the arrow next to “What’s new”, we could see that the size doesn’t change (from what we can see).

FIX:
Basically all I needed to do is increase of the multiplication for the UDim2.new(). The change was so small that we couldn’t see it (Our eyes weren’t capable to see the difference).

Thank you to everyone who helped me :))