local TweenService = game:GetService("TweenService")
local part = script.Parent
local function blast(part)
local beam = part:FindFirstChild("Beam")
if not beam then
warn("Beam not found in part.")
return
end
local sizedata = 100
local originalSize = beam.Size
local newSize = originalSize + Vector3.FromAxis(Enum.Axis.Z) * sizedata
local frontOffset = part.CFrame.LookVector * (originalSize.Z / 2)
beam.CFrame = part.CFrame + frontOffset
beam.CFrame = part.CFrame + part.CFrame.LookVector * (originalSize.Z / 2)
local sizeTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local sizeTween = TweenService:Create(beam, sizeTweenInfo, {Size = newSize})
sizeTween:Play()
sizeTween.Completed:Wait()
end
blast(part)
you will need to move it by half the amount you want to resize it by
like if you will increase its z axis size by 150 then you will need to move it to the z axis 150/2 or 75
example
local TweenService = game:GetService("TweenService")
local part = script.Parent
local extendZAxisBy = 50
local sizeTween = TweenService:Create(part,
TweenInfo.new(8),
{Size = part.Size + Vector3.new(0,0,extendZAxisBy)}
)
local PositionTween = TweenService:Create(part,
TweenInfo.new(8),
{Position = part.Position + Vector3.new(0,0,extendZAxisBy/2)} -- divided by 2 because origin point is at the middle of the cube
)
sizeTween:Play()
PositionTween:Play()