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

How do I resize a part one way?

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)

6 comments

0

offset the position by half the size

0

how do I offset the position?

0

Add to the current position by a vector

0

Sorry, I still don't understand how to do that

0

part.Position = part.Position + Vector3.new(0, part.Size / 2, 0) -- pick ur axis

0

Thank you, but it still resizes on the back and front of the cylinder

1 answer

✓ Accepted answer
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 

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