Issues with scaling

I’ve been having two issues while trying to tween an object’s size and position.

  1. Whenever I try to change the size of a part in a certain direction such as on the Z axis, the part instead scales on the Y axis instead. However, this is fixed when I change the orientation of the part to (-90, 0, 0) which makes no sense to me, although I would greatly appreciate if someone could explain this to me. Currently, the default orientation for the part is (0,0,0) and I hope to keep it that way so I’d rather not leave the orientation at (-90, 0, 0) to fix this issue.
CURRENT CODE SEGMENT
local PartTweenGoal = {
		Size = Vector3.new(10, 100, 10)
        --Position = Part.Position + Vector3.new(0, 0, -50)
	}

In this situation, the part scales 100 studs on the Z axis despite being told to scale on the Y axis.

  1. In order to counter the part scaling in both directions, I added another key in “PartTweenGoal” which would move the part half the length of the part’s size forward on the Z axis. However, this creates another problem where the part doesn’t move on the Z axis relative to the player’s LookVector and instead only moves on the Z axis relative to the baseplate. So how would I go about making the part move (X) studs in the direction of the player’s LookVector?
CURRENT CODE SEGMENT
local PartTweenGoal = {
		Size = Part.Size + Vector3.new(10, 100, 10),
		Position = Part.Position + Vector3.new(0, 0, -50)
	}

Here’s a GIF where you can get a visual representation of the problem I’m having.
https://gyazo.com/df5c64a9d1378ef318c0fbc15f77fc5b

To move the part forward, relative to the HumanoidRootPart, you can use the lookVector of the HumanoidRootPart’s CFrame.

Position = Part.Position + character.HumanoidRootPart.CFrame.LookVector*50

I’ve tried that, I apologize for not mentioning in the post, but the reason why I’m increasing the position as well is to give the illusion that the part is only scaling in one direction. However, using this method doesn’t work for my situation.

So is the orientation of the part also supposed to be relative to the orientation of the HumanoidRootPart?

CFrame = character.HumanoidRootPart.CFrame*CFrame.new(0, 0, -50)

No not really, I only need the position of the part to be equal to that of (X) amount of studs in the direction the player is looking.

For a better idea of what I mean, imagine this.

  1. Part increases in size by 1 stud on the Z axis. Due to the way that scaling works, it grows in both directions.

  2. Part moves forward 1 stud on the Z axis, creating the illusion that the part only grew in one direction.

  3. Repeat.

The problem I’m facing is that for some reason the part doesn’t move on the Z axis relative to the player but instead relative to the world space.

If you want to create an illusion of the part scaling in one direction, you should probably move it relative to itself. And if you also want the position to be relative to the humanoidrootpart, you can remove (-) the position of the CFrame and then add (+) the desired position.

CFrame = (Part.CFrame-part.Position+HumanoidRootPart.CFrame*Vector3.new(0, 0, 50))*CFrame.new(0, 0, 50)

This should make the position relative to the HumanoidRootPart without changing the orientation of the part and then add the scale in one direction.

I tried both methods however none of them seemed to work, I’m not too good with CFrames so it’s a bit tricky for me to understand what this line of code is actually doing.

https://gyazo.com/203a13e122ab08385b1d127e9f968d9e

Is the part supposed to look like it scales in one direction but doesn’t move? Because if you want it to look like what happens when you use the scale tool in studio, maybe just doing this will work.

CFrame = Part.CFrame*CFrame.new(0, 0, 50)

Pretty much yea, It technically does move as I’m tweening the position as well, but because it scales in both directions it creates the illusion that it isn’t.

I’m still having the same issues with the new method you just sent, as it seems that using CFrame in general keeps glitching out my tween for whatever reason.

Based on the latest video you sent, the part seems to move downwards. Have you tried changing the order of the values in CFrame.new(0, 0, 50)? Maybe this would do the correct thing. Because the size is changed on the part’s Y axis, the position should be changed on that too.

CFrame = Part.CFrame*CFrame.new(0, 50, 0)

That was actually one of the issues I stated in the original post. Although I haven’t tried changing the order of the values, is there a potential fix or reason for whats happening?

In the meantime I’ll give it a shot.

Well, the first problem you mentioned seems quite odd. So… when the orientation of the part is (0, 0, 0), it scales vertically when you change the Z coordinate (last coordinate) of the size? If that’s what happens, I don’t know what could be the reason.

Old

That actually did seem to fix the problem, however the first time I activate the ability it glitches out like how it originally did in the GIF’s I sent you. Although this issue might be coming from somewhere else, I have a few guesses from where.

Nevermind, it seems that it still locks on to the Z axis relative to the world space. I’m completely stumped on this, I don’t have any idea on how to fix this.

But yea, you’re exactly right. If the orientation is (0,0,0), the Y and Z axis gets switched up for some reason, I have to manually change the orientation to (-90, 0, 0) for it to be fixed. I’m not sure if this is a bug or if I’m somehow missing something.

Bumped, still looking for help.