I want to grow every part named "GasPart". But it grows every part with this name to the same size. These parts are all different sizes, so could they all grow the same amount on the y axis?
01 | for k,n in pairs (game.Workspace:GetChildren()) do |
02 |
03 | if n.Name = = "GasPart" then |
04 | SizeOfX = n.Size.x |
05 |
06 | end |
07 | end |
08 |
09 | local TweenService = game:GetService( "TweenService" ) |
10 | local GasPart = game.Workspace.GasPart |
11 | local y = 17.051 |
12 | local z = 11.5 |
13 | local x = SizeOfX |
14 |
15 | local Info = TweenInfo.new( |
You'll need to put the goal of the tweening inside of the for loop so that you can get the relative size to each part.
I'd create a variable with the amount that I want to be added and then inside of the for loop add that to the current size in the goal.
01 | local AmountToAdd = Vector 3. new( 10 , 10 , 10 ) |
02 |
03 | for k,n in pairs (game.Workspace:GetChildren()) do |
04 | if n.Name = = "GasPart" then |
05 |
06 | local Goals = { |
07 | Size = n.Size + AmountToAdd |
08 | } |
09 |
10 | local exampletween = TweenService:Create(n, Info, Goals) |
11 | exampletween:Play() |
12 | end |
13 | end |