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

How do I scale a body part in ONE direction of ONE axis?

game.ReplicatedStorage.FruitRemotes.GomuGomu.Pistol.OnServerEvent:Connect(function(player, mousePos, fruit)
	local character = player.Character
	local arm = {character.RightHand, character.RightLowerArm, character.RightUpperArm}
	local animation = character.Humanoid:LoadAnimation(fruit.PistolAnim)
	animation:Play()

	local Tween = game:GetService("TweenService")
	local scalefactor = 3
	local offset
	local dialationCentre = (character.RightUpperArm.Position + character.RightLowerArm.Position + character.RightHand.Position)/3
	local info = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
	)
	
	for i,v in pairs(arm) do
		local pos = v.Position
		local offset = pos - dialationCentre
		offset = offset * scalefactor
		
		local Goals =
		{
		Position = dialationCentre + offset;
		Size = v.Size * Vector3.new(1,scalefactor,1)
		}
		local gomuTween = Tween:Create(v, info, Goals)
		gomuTween:Play()
	end
	
end)

I'm trying to scale an arm with a tween, however, I only want the arm to scale in one direction of an axis. Not BOTH. It should look like an arm-stretching forward. For some reason it will always scale both directions. I read a forum that dilation could work fixing this problem, but it goes over scaling all axis, so I'm not sure how to do this. Please, if you know a way to solve this, please answer. Been stuck with this problem for almost a day now.

1 answer

Your looking for Resize. It functions similar to this:

Part:Resize(Enum.NormalId.Direction, 1) 

Replace Direction with the face you want to resize and replace the # with the amount of studs you want to expand it by.

Though I'm not 100% sure it will work with a tween. But its still worth trying.

3 comments

0

I'll give that a shot

0

Didn't work. It for some reason also scaled the front side as well :/

0

Strange, seems you will have to do the math yourself then. So add half of what you are scaling by to the position.

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