So, I'm creating a Kamehameha wave, and when the beam is triggered to fire, both sides of the part expand. How do I fix this?
01 | script.Parent.Charge:Play() |
02 | for i = 0.57 , 2.16 , 0.03 do |
03 | script.Parent.Size = Vector 3. new(i,i,i) |
04 | wait( 0.1 ) |
05 | end |
06 | beam = Instance.new( "Part" , script.Parent.Parent) |
07 | beam.Name = "Beam" |
08 | beam.Material = "Neon" |
09 | beam.BrickColor = BrickColor.new( 9 , 137 , 207 ) |
10 | beam.Size = Vector 3. new( 0.99 , 1.77 , 2 ) |
11 | beam.Shape = "Cylinder" |
12 | beam.Anchored = true |
13 | beam.Position = script.Parent.Position + Vector 3. new(- 0.825 , 0.040 , 0.022 ) |
14 | script.Parent.Fire:Play() |
15 | for i = 0.24 , 18.5 , 1.2 do |
16 | beam.Size = Vector 3. new(i, 1.77 , 2 ) |
17 | wait( 0.05 ) |
18 | end |
the part's position marks the center of the part, meaning if you were to change its size on, lets say a positive X axis, both sides would extend half the specified amount. to fix this, counteract it by moving forwards by half the amount you extended it
01 | --set up the part |
02 | local brick = Instance.new( "Part" , workspace) |
03 | brick.CFrame = CFrame.new( 0 , 25 , 0 ) |
04 | brick.Anchored = true |
05 |
06 | --ACTION |
07 |
08 | for i = 0 , 100 , 1 do |
09 | wait() |
10 | brick.Size = Vector 3. new(i, 1 , 1 ) |
11 | brick.CFrame = CFrame.new(i/ 2 , 25 , 0 ) |
12 | end |