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 make it where it only scales in one direction of a body part?

I'm trying to make your arm stretch in only one direction, but I can't do this because it will always scale on both opposite sides. I've tried ReSize, I've tried to make separate different tweens, and I don't know what to do. Someone please help!!

Server Script

	game.ReplicatedStorage.Events.gumCharge.OnServerEvent:Connect(function(player)
		local Tween = game:GetService("TweenService")
		local char = player.Character or player.CharacterAdded:Wait()
		local rArm = {ruArm = char:WaitForChild("RightUpperArm"), rlArm = char:WaitForChild("RightLowerArm"), rHand = char:WaitForChild("RightHand")}
		local info = TweenInfo.new(
			2,                        --Length(seconds)
			Enum.EasingStyle.Sine,   
			Enum.EasingDirection.Out,
			0,                        --Times Repeated
			false,                    --Reverse
			.5)                       --Delay (seconds)
		
		local ruSize = {Size = Vector3.new(1, 22, 1), Position = Vector3.new(rArm.ruArm.Position.X, rArm.ruArm.Position.Y, rArm.ruArm.Position.Z + rArm.ruArm.Size.Z/2)} 
		local rlSize = {Size = Vector3.new(1, 16, 1), Position = Vector3.new(rArm.rlArm.Position.X, rArm.rlArm.Position.Y, rArm.rlArm.Position.Z + rArm.rlArm.Size.Z/2)}
		local rSize =  {Size = Vector3.new(1, .3, 1), Position = Vector3.new(rArm.rHand.Position.X, rArm.rHand.Position.Y, rArm.rHand.Position.Z + rArm.rHand.Size.Z/2)}
		
		local ruTween = Tween:Create(rArm.ruArm, info, ruSize)
		local rlTween = Tween:Create(rArm.rlArm, info, rlSize)
		local rTween = Tween:Create(rArm.rHand, info, rSize)
				
		ruTween:Play()
		rlTween:Play()
		rTween:Play()
	end)

1 answer

Set the CFrame of the part in half. When you Size a vector part, it grows in two directions, but only half of the size per direction.

Here's an example:

local part=Instance.new('Part',workspace);
print(part.Size);-->  4, 1.2, 2
wait(5);
part.Size=part.Size+Vector3.new(2,0,0);
print(part.Size);--> 6, 1.2, 2
-- notice how even if i increased the x size vector by 2 studs, it only grew by one stud on each side.
wait(2)
for _=1,10 do
part.Size=part.Size+Vector3.new(.5,0,0);
part.CFrame=part.CFrame*CFrame.new(.25,0,0);--> now, the size grows on one side instead of two,
wait(.1)-- transition
end;

2 comments

0

It didn't work. I think i'm doing something wrong, can you help me? If you want, we can DM in discord.

0

naw if it doesnt work theres something you know that we dont

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