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

Why does my my part extend from both sides?

Asked by 6 years ago

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?

script.Parent.Charge:Play()
for i = 0.57, 2.16, 0.03 do
    script.Parent.Size = Vector3.new(i,i,i)
    wait(0.1)
end
beam = Instance.new("Part", script.Parent.Parent)
beam.Name = "Beam"
beam.Material = "Neon"
beam.BrickColor = BrickColor.new(9,137,207)
beam.Size = Vector3.new(0.99,1.77,2)
beam.Shape = "Cylinder"
beam.Anchored = true
beam.Position = script.Parent.Position + Vector3.new(-0.825, 0.040, 0.022)
script.Parent.Fire:Play()
for i = 0.24, 18.5, 1.2 do
    beam.Size = Vector3.new(i,1.77,2)
    wait(0.05)
end

1 answer

Log in to vote
1
Answered by 6 years ago

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

--set up the part
local brick = Instance.new("Part", workspace)
brick.CFrame = CFrame.new(0,25,0)
brick.Anchored = true

--ACTION

for i=0,100,1 do
    wait()
    brick.Size = Vector3.new(i,1,1)
    brick.CFrame = CFrame.new(i/2,25,0)
end
0
this would only extend one side correct? supercoolboy8804 114 — 6y
0
technically, both side are extending, you are just moving it to contract it and to simulate a different anchor point, so yes fanofpixels 718 — 6y
Ad

Answer this question