Scale frame or image with TweenService

I already made posts about tweenservice, but since i don’t know how can i scale 2d stuff, i was forced to post again: I want to make a script which makes a frame or an image bigger, using tweenservice, but i don’t know how can i do that, something simple i guess. Thanks for reading. msmsms

I am pretty sure this is what you are looking for:
GuiObject | Documentation - Roblox Creator Hub.

Alternatively if you want to move it too:
GuiObject | Documentation - Roblox Creator Hub.

1 Like

TweenSize and TweenSizeAndPosition are a bit outdated compared to TweenService.

Those methods can change the Size and Position of GuiObject only. TweenService can act on almost any other property, including Color3, Transparency, Rotation, and more. In addition, it isn’t limited to GuiObjects.

Here’s a quick starter example on using TweenService to change a Frame’s Transparency.

local tweenService = game:GetService("TweenService")

-- pathToFrame is the Frame you'd want to change.
local frame = pathToFrame 

-- What style should the tween be in?
local easingStyle = Enum.EasingStyle.Cubic

-- Which direction will the tween go?
local easingDirection = Enum.EasingDirection.In

-- How long will the tween last?
local tweenTime = 5

-- Create the info for the tween, can be reused in other tweens.
local tweenInfo = TweenInfo.new(tweenTime, easingStyle, easingDirection)

-- What properties do we want to adjust?
local propertyTable = {
		BackgroundTransparency = 1 -- Lets change the frame's transparency.
	}

-- Create the tween, following the settings we made in tweenInfo.
local tween = tweenService:Create(frame, tweenInfo, propertyTable)

-- Play the tween.
tween:Play()

Here’s a smaller version that does the same exact thing.

local tweenService = game:GetService("TweenService")

tweenService:Create(pathToFrame, -- The object we want to change.
	TweenInfo.new(5, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), -- The TweenInfo
	{BackgroundTransparency = 1} -- Property Table
):Play()

Some good references that could help you understand TweenService better.

This one is a general page of the service, and includes some code examples at the bottom.

How to create the basic Tween adjustments. (Time, Style, Direction)

Documentation for how to create a Tween.

The object you get from TweenService:Create()

Let me know if you need anything else!

2 Likes