Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a brick that grows and stops at a certain point?

I don't have a script for it, but I want to get a brick that grows and stops after a few seconds, how is this possible?

1 comment

0

You could use tween service

1 answer

✓ Accepted answer

You will have to create a tween for this. I provided the code below, but made plenty of comments to explain it thoroughly, but let me know if you need help understanding it.

-- In a script under a Part located in Workspace
local tweenService = game:GetService("TweenService") -- getting the tween service
local myPart = script.Parent -- getting our part to resize

-- Using TweenInfo.new() to insert our desired customize behavior we want for the tween
local tweenInformation = TweenInfo.new(
	5, -- Will take 5 seconds to grow into our desired size
	Enum.EasingStyle.Linear, -- determines the behavior of the tween. Think of linear as growing in a straight line.
	Enum.EasingDirection.Out, -- Determines if the tween will grow inward or grow outward. In this case, we need it to grow out.
	0, -- How many times will this tween repeat? 0, because we don't want it to repeat.
	false, -- Do you want this tween to reverse back? No, in this case false.
	3 -- Do you want this tween to delay before starting? How long in seconds?
)

local desiredSize = {Size = Vector3.new(30, 20, 50)} -- the size we want our part to grow out to be

-- Creating the connection and storing it in a variable called "tweenConnection"
local tweenConnection = tweenService:Create(myPart, tweenInformation, desiredSize) -- takes 3 parameters: (our part, the tween information, and the desired change)

tweenConnection:Play() -- Playing our tween similarly like playing an animation. 

This discussion is preserved as it was. New answers, comments, and votes are closed.