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

How can I make this expand without making like a million waits?

Asked by
sonuka 24
6 years ago

How can I make this Part slowly increase in size from (0.3,5,5) until it's (0.3,200,200) without making like a million wait()s?

local a = Instance.new("Part", workspace)
a.Shape = "Cylinder"
a.Size = Vector3.new (0.3,5,5)
--to
a.Shape = "Cylinder"
a.Size = Vector3.new (0.3,200,200)
0
;/ i dont rlly get this sonuka 24 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Theres two ways of doing this. TweenService or Repeat statements. http://wiki.roblox.com/index.php?title=API:Class/TweenService http://wiki.roblox.com/index.php?title=Loops#Repeat

First Method: TweenService

local TS = game:GetService("TweenService")
local a = Instance.new("Part")
a.Size = Vector3.new(0.3,5,5)
a.Shape = "Cylinder"
a.Parent = Workspace

local goal = {}
goal.Size = Vector.new(0.3,200,200)

local TI = TweenInfo.new(5) --// The number is where how much seconds it gets to its goal

local tween = TS:Create(a,TI, goal)
tween:Play()

TweenService helps you resize your parts in a really smooth manner.

Second Method: Repeat


local a = Instance.new("Part") a.Size = Vector3.new(0.3,5,5) a.Shape = "Cylinder" a.Parent = Workspace local interval = 1 --// Set this to how much you it to change everytime repeat a.Size = Vector3.new(0.3,a.Size.X+interval,a.Size.Z+interval) wait(0.01) --// Set this to whatever until a.Size == Vector3.new(0.3,200,200)

This is a very inefficient way to do it. I don't even know when it stops.

Hopes this helps.

0
for loop is way more efficient then repeat. Axceed_Xlr 380 — 6y
0
The TweenService option is the best one imo. Le_Teapots 913 — 6y
0
i'd use repeat, it isn't very good though greatneil80 2647 — 6y
Ad

Answer this question