Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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?

0
You could use tween service DarkDanny04 407 — 4y

1 answer

Log in to vote
0
Answered by
Yozoh 146
4 years ago

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. 
Ad

Answer this question