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

How do I resize a part one way?

Asked by 6 years ago
Edited 6 years ago

The cylinder resizes on the back and front. I only want it to resize on the front.

LaunchRemote.OnServerEvent:Connect(function(player, Cooldown)
    local character = player.Character or player.CharacterAdded:wait()

    if character then
        character.HumanoidRootPart.Anchored = false
    end

    if charge then
        charge.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2)
    end

    local TweenInform = TweenInfo.new(
        1,
        Enum.EasingStyle.Linear,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )

    local properties = {
        Size = Vector3.new(4, 4, 4)
    }

    local Tween = TweenService:Create(charge, TweenInform, properties)
    Tween:Play()
    if charge then
        charge.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2.5)
    end

    local launch = Instance.new("Part")
    launch.BrickColor = BrickColor.new("Cyan")
    launch.Anchored = true
    launch.CanCollide = false
    launch.Shape = "Cylinder"
    launch.Orientation = Vector3.new(0, 90, 90)
    launch.Material = "Neon"
    launch.Size = Vector3.new(1, 15, 15)
    launch.Parent = charge

    launch.CFrame = charge.CFrame * CFrame.Angles(0, math.rad(90), 0)
    --launch.CFrame = CFrame.Angles(0, math.rad(90), 0)

    local TweenInform2 = TweenInfo.new(
        0.5,
        Enum.EasingStyle.Linear,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )

    local properties2 = {
        Size = Vector3.new(60, 15, 15)
    }

    local Tween2 = TweenService:Create(launch, TweenInform2, properties2)
    Tween2:Play()
    launch.CFrame = charge.CFrame * CFrame.Angles(0, math.rad(90), 0)
    launch.Position = launch.Position + Vector3.new(launch.Size / 2, 0, 0)
end)
0
offset the position by half the size EpicMetatableMoment 1444 — 6y
0
how do I offset the position? n0body4 2 — 6y
0
Add to the current position by a vector EpicMetatableMoment 1444 — 6y
0
Sorry, I still don't understand how to do that n0body4 2 — 6y
View all comments (2 more)
0
part.Position = part.Position + Vector3.new(0, part.Size / 2, 0) -- pick ur axis GoldAngelInDisguise 297 — 6y
0
Thank you, but it still resizes on the back and front of the cylinder n0body4 2 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago
local increase = Vector3.new(1,0,0)
script.Parent.Position = script.Parent.Position+ increase/2 -- /2 is divide by two, make it a minus number if you want it to extend backwards
script.Parent.Size = script.Parent.Size + increase 

Ad

Answer this question