Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my my part extend from both sides?

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

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

2 comments

0

this would only extend one side correct?

0

technically, both side are extending, you are just moving it to contract it and to simulate a different anchor point, so yes

This discussion is preserved as it was. New answers, comments, and votes are closed.